Categories
WordPress

Walking with 1.5

Had a chance to comb through some of the latest WordPress 1.5 code (through 2005-01-05) in CVS, both in the course of a fresh install and in the course of code analysis for development of some new plugins. Spotted a few things that would benefit from improvement (nothing critical).

Categories
Site

The sizzle before the cool-off

Sorry for having been incommunicado for the last few days. Life has been busy. And promises to be even more so in the next few weeks. With my free time dwindling to zero until I can resurface again (weeks??), I am devoting the rest of the night (and maybe some of tomorrow depending on how far I get) making updates to many of the plugins I’ve made.

I’m hoping I don’t introduce critical errors since I won’t be around to field support questions. But if you’ve got questions, ask ’em now. If you’re reading this site more than a couple days from this posting and haven’t seen any responses or postings from me in awhile, you’ll have to wait until I get back before you’ll get an answer to your question/request.

I better get to it…

TEST: This a test of a new post-to-post linking plugin. You should see a post title here:

Categories
WordPress

Miscellenous WP 1.3 development notes/ideas

A list of things I’ve noted, provided, or want to inquire about to help contribute to WordPress v1.3 (or as ideas for future versions), roughly in ascending order from trivial to implement to complex.

Categories
Package/plugin/module WordPress

Plugin: Customizable Post Listings

This plugin has been updated! Comments to this post are now closed. For the latest download, documentation, and link for posting new comments related to this plugin, visit the plugin’s new homepage at:
coffee2code.com/wp-plugins/customizable-post-listings
Name:
Customizable Post Listings
Author:
Scott Reilly
Version:
1.1
Last updated:
27 September 2004
Description:

Display Recent Posts, Recently Commented Posts, Recently Modified Posts, Random Posts, and other post listings using the post information of your choosing in an easily customizable manner. You can narrow post searches by specifying categories and/or authors, among other things.

Categories
WordPress

Patch: Dealing with multiple <!–more–>

Bug 0000113 is titled “Post content ‘lost’ if multiple <!–more–> (more…) tags used“. Which basically says that if more than 1 <!–more–> tag is located in the content of a post, you’d only ever see the text up to the second <!–more–>. All subsequent text, though still part of the post content in the database, will never be displayed. The fix is extremely simple:

In wp-includes/template-functions-post.php, in the function get_the_content(), change this line:

$content = explode('&lt&;!--more-->', $content);

to this:

$content = explode('&lt&;!--more-->', $content, 2);

The third argument to explode(), the limit arg, was introduced in PHP 4.0.1, and since WP supports PHP 4.1, the fix should be valid. This way text before the first <!–more–> will be put into $content[0] (as expected), and all other post content, regardless of subsequent <!–more–> tags, will be put into $content[1] and therefore not “lost”.

Here is the patch (modified from, and then compared against, the latest WP 1.3 from CVS).

Categories
WordPress

Patch: Balancing pre-‘more’ tags

One of my nits about WP, from my original formatting problems post, was that despite balancing tags for an entire post, WP wouldn’t do so for text appearing before a <!–more–> tag. Others have noted this in the support forums, and it was reported as bug 0000178, titled “WP doesn’t close tags when breaking a page with <!–more–>”. This fix is actually quite simple.

Categories
WordPress

Patch: Fixing balanceTags()

Continued from my previous post in which I examined, and provided examples for, various problems related to the WordPress core function balanceTags(), here’s an explanation of the changes I made to the function.

First, here is a copy of the original balanceTags() function.

Here is a copy of the modified balanceTags() function.

Here is a diff of the changes to the file wp-includes/functions-formatting.php diff of the changes to the file wp-includes/functions-formatting.php (modified from and then compared against the latest version as obtained from CVS for WP 1.3).

Here’s my justification for the changes I made. The first of my changes takes place early, in the while() where it iterates through all the functions in the text. The remaining fixes are in the function related to finding an open tag. These fixes address all issues I am aware of with the balanceTags() function (except for situations I mention at the very end).

Categories
WordPress

Examining balanceTags()

Prompted by WP Patch Day, I felt compelled to try to patch a bug with WordPress.

I choose one that has already caused me numerous headaches, bug 0000053, entitled “WordPress deletes some text when HTML tags incorrectly nested”.

In a nutshell… In the Admin sections “Options” menu, “Writing” submenu, a checkbutton exists to indicate if “WordPress should correct invalidly nested XHTML automatically”. This setting is active by default.

The thing is, not only does it not always correct invalidly nested XHTML, it can actually delete some of the text in the post. As the function operates on the post as the post is inserted into the database, that text is gone.