Archive for the 'WordPress Code & Hacks' Category (Feed)

h1“Quoter” Validation Fix

Posted on Tuesday, April 22nd, 2008 at 3:45 AM (7 months, 2 weeks ago)

Seems Quoter doesn’t play 100% nice with WordPress 2.5 (breaks page validation). It’s a simple fix though.

Open the plugin and find this text on line 568:

$text = wpautop($text, 0);

Before it, add this dirty little fix:

$text = str_replace( array('<p><p>', '</p></p>'), array('<p>', '</p>'), $text);

It only works around the problem rather than fixing it, but it seems to do the job as most pages now validate. :)

EDIT: Seems WordPress originally mucked up the code that I had posted. It’s now been fixed.

h1How To: Display Text At End Of Post In Only Single View

Posted on Sunday, December 2nd, 2007 at 6:54 PM (1 year ago)

Ever wanted to display some text at the end of your post that would only show up on the single post view? Perhaps a message to commenters? Well, WordPress has the ability built in. No need for any plugins.

The trick is to use the <!--more--> tag. However, I bet you’re thinking “but I don’t want a ‘Read More’ link!”. Well, once again, WordPress to the rescue.

For a few major versions now, you can do custom more text. You simply format it like this: <!--more Check out the rest of my post!-->. Or, to remove the link altogether while still leaving the feature intact, just use a space: <!--more -->.

Here’s an example:

This is a cool post. It has lots of interesting stuff.

More interesting stuff.

<!--more -->

This text will only show up on the single post view.

You can check it out in action as the following text will only show up in single post view:

#