jerrypeek
Forum Replies Created
-
Forum: Plugins
In reply to: in-series plugin: all_series() doesn’t return all series namesI fiddled with the get_all_series() function to fix the problem — I hope. I’m no PHP hacker, so I’d be glad for someone to correct me. Here’s a patch to in-series.php version 2.0:
--- in-series.php 2006/12/11 20:52:18 1.1
+++ in-series.php 2006/12/11 21:19:56
@@ -3,7 +3,7 @@
Plugin Name: In Series
Plugin URI: http://www.skippy.net/
Description: Provides navigation controls for next/previous within a connected series of posts
-Version: 2.0
+Version: 2.0+
Author: Scott Merrill
Author URI: http://www.skippy.net/
@@ -94,13 +94,24 @@
AND b.meta_key='series_order')
GROUP BY a.post_id
ORDER BY CAST(b.meta_value AS SIGNED)
- ASC LIMIT 1;");
+ ASC LIMIT 10;");
if ( (! $result) || ( count($result) == 0 ) ) {
return FALSE;
}
foreach ($result as $r) {
+ /*
+ * Suppress duplicates (by Jerry Peek, 11 Dec 2006):
+ */
+ if ($all) {
+ foreach ($all as $id => $title) {
+ if (strcmp($r->meta_value, $title) == 0) {
+ continue 2;
+ }
+ }
+ }
+ // If we get here, no existing value matches, so this isn't a duplicate:
$all[$r->post_id] = $r->meta_value;
}The indentation above doesn’t appear, and this system doesn’t seem to allow <pre> tags, so you’ll just have to follow the braces. (I guess a bunch of
entities would do the job…)In case you haven’t seen patches before, this one says:
- Change the plugin version number (on line 6) from
2.0to2.0+. (This is an unofficial change, so I added a +.) - In the call to
$wpdb->get_results(line 97), change the LIMIT of 1 to 10. This returns up to 10 results. (I think it should be much higher — probably the total number of post_ids in the database — but I’m thinking that there must be a better way. Suggestions, please.) - Add code before line 104 that doesn’t add a new member to
$allunless that series_name doesn’t exist yet in$all.
This is a hack, so I’m hoping someone who knows PHP and WP coding can fix it and show me a better way. Thanks.
Forum: Installing WordPress
In reply to: Is WordPress wrong for us? (Calling WP “philosophers”)Will do, vkaryl — backups before I do any serious editing, I mean. Right now I’m just trying to get a dev site working, to be sure WordPress will work for us.
I pasted one long tricky HTML page into PQPMyAdmin last night — one of the pages that freezes the server when I try to paste it in via the WP “classic” editor — and it worked great. Now the page looks fine in my browser, and it validates too.
Yesterday I found a support thread http://ww.wp.xz.cn/support/topic/20768 about using MT Import to copy content into WordPress. It’s pretty old, so I don’t know if it will work. But I might try it too.
Forum: Installing WordPress
In reply to: Is WordPress wrong for us? (Calling WP “philosophers”)Thanx again, doodlebee. This is all really helpful — especially the tip about wp-blog-header.php. But I just realized that if I don’t put content in the WP database, it’s not only the search that won’t work. Our “email this” plugin won’t work. And more. So I think I should keep fighting this out with WordPress 🙁 for now.
I just thought of another way. The server freezing and link reformatting seemed to happen in the WP “classic” editor (the inline-uploading.php and execute-pings.php scripts hang on the server; I can see that by running ps). For the complex pages with those problems, if I can bypass the editor and put content straight into the WP database, that’d be at least half the battle.
For instance, I might create the Post from the editor with everything except its content, then open the database post_content field through PHPMyAdmin and paste the HTML there. I’d have to escape the doublequotes (turn each
"into\"), but that’s easy.If this idea sounds dangerous, please warn me off. 😉 Otherwise I think I’ll try it on our development site.
Forum: Installing WordPress
In reply to: Is WordPress wrong for us? (Calling WP “philosophers”)Hmmm, vkaryl… our sidebar has a lot of calls to functions from plugins and from WP itself, like
series_table_of_contents()andwp_list_pages(). If we don’t have WordPress functionality on the static XHTML pages, those pages could feel different to visitors than the dynamic pages running under WP. Also, I guess that the WP “search” functionality wouldn’t work on the static pages.Are those kinds of things a problem on your sites — and, if they are, do you have ways to work around them?
Forum: Installing WordPress
In reply to: Is WordPress wrong for us? (Calling WP “philosophers”)I think we might want some combination of 1) a CMS for more-dynamic content (we do want to have more contributors and “action” on the site) plus 2) the existing (cleaned-up) static XHTML pages with PHP includes to pull in stuff that’s going to appear on every page. I’ll experiment with that, thanks vkaryl! (If you have a more complete example, that’d help: when I’ve tried to insert PHP code in my WordPress pages, the server doesn’t interpret it; I just see the PHP when I do “view source” on my browser. I guess I need to make pages named foo.php with some WordPress PHP calls in them…)
doodlebee, how do you upload content into WordPress with FTP?? I’ve been searching for that info since Day 1. (I also have SSH access to the server files, and I can run MySQL commands. I’m just not very familiar, and I haven’t found a straightforward “howto”.) Even the “classic” editor — or some code it runs — has been doing some of the link-munching. If I could eliminate that variable from the WP system, I might be closer to the system we need.
Your comments are a real help! (More thoughts about my original question, anyone else?)
Forum: Installing WordPress
In reply to: Is WordPress wrong for us? (Calling WP “philosophers”)Thanks for making it through my long post, vkaryl and doodlebee. Yes, “correct invalidly nested XHTML automatically” is unchecked, and I didn’t use the WYSIWYG editor to pour the XHTML into WordPress or to edit it later.
I forgot to say: We’re hoping to have new contributors who are subject-matter experts but not (necessarily) HTML hackers. So it’d be nice to have the “beautifying” features of WordPress for their contributions, but not have WordPress “beautify” my old XHTML.
Forum: Fixing WordPress
In reply to: WP “classic” HTML editor doesn’t show all HTML tagsI’m still having trouble. It seems that, even if I don’t put ANY blank line, something is adding p tags around some of the code I insert. For instance, I’m trying to insert the HTML code to produce a Google Search box like the two in the body of http://www.googleguide.com/similar_pages.html. No matter what I do — even if I type all of the HTML on a single line with no line breaks — I still end up with garbage.
HandySolo, I think you’re right about autop getting in the way. I’ve read the long post WordPress Editor Driving Me Insane. It sounds like the HTML stored in the database is modified by autop as the final page is being rendered.
I’ve had some luck with the Mime Type Plugin. I installed it, then I wrote a Post in the “classic” WordPress editor with some HTML p and /p tags in the body. Underneath the editing window, I added a Custom Field with name
mime_typeand valuetext/html. When I saved the Post, opened it in a new browser window, and used the browser’s View Source command, I saw exactly the HTML I’d input — the same line breaks and everything. Excellent.Some HTML still seems to freeze the server, though. For instance, when I tried to “Save and Continue Editing” after adding an HTML FORM tag with method=GET, my browser’s spinner kept spinning — as if the server hasn’t finished serving the page — and I couldn’t load the page in other browser windows either. I’m not sure where the problem is, but I get the idea that WordPress just isn’t designed for serving arbitrary HTML.
Thoughts, anyone? (Check out that Mime Type plugin, anyway!) Thanks…
Jerry
Forum: Fixing WordPress
In reply to: WP “classic” HTML editor doesn’t show all HTML tagsThanks a lot! I’ll start working on this.
Forum: Fixing WordPress
In reply to: WP “classic” HTML editor doesn’t show all HTML tagsSounds like good advice, moshu. I’ve got a big and busy site to port to WordPress, so the HTML needs to be right. Any advice about what to use instead of this editor? I’ve done lots of searching in the Codex and Support Forums, and found lots of people asking this same kind of question, but I haven’t found any other answers.
The best for me would be if I could download that HTML code for the Post (the text that people read — not the Theme or other stuff) onto my local computer and edit it directly with the plain-text editor that I use for other HTML editing. I can use FTP, log into the server and use a shell (command line) to run MySQL commands, or whatever else. I don’t mind complicated steps if that’s what’s needed. Thanks again for any advice!
Forum: Fixing WordPress
In reply to: WP “classic” HTML editor doesn’t show all HTML tagsThanks for that tip, moshu.
But I’m still wondering how to see all of the HTML that will be sent to the browser of someone who reads one of my Posts. It seems that the WP classic HTML editor may be “sanitizing” the HTML that it lets me edit. I’d at least like to know what rules it’s following when it does this. In case it helps, here are some specific questions:
- What tags are “hidden” or added automatically in the text I see in the editor window?
- If I type a blank line (press ENTER twice), does the editor replace that line with a /p tag followed by a p tag?
- If I type a p tag or a /p tag, does the editor delete them, or could I end up with two p tags in a row (mine, plus one that the editor adds)?
I want to understand how this editor works so I’ll be more sure that my HTML is what I intend it to be.
- Change the plugin version number (on line 6) from