Blogpad An exercise in brevity.

Posts tagged with “wordpress”


HOWTO: Fix the TextileWrapper/WordPress "blank line" bug

If you’re using the TextileWrapper plugin for WordPress in conjuction with the latest version of classTextile.php you may stumble upon this odd bug: if your posts don’t start with a blank line (which means all of your posts) the first paragraph isn’t wrapped within <p> tags thus breaking the page’s layout.

As you can tell this get annoying fast — esp. considering that WordPress automatically removes the first blank line each time you bring back the post to edit it.

I will try to fix you (Flickr)


Here’s a quick fix I came up, inspired by a tip I stumbled upon on creating WordPress post templates: locate the edit-form-advanced.php file within your wp-admin directory, find the following line:

<?php the_editor($post->post_content); ?>

Above it, write the following:

<!-- ADDED -->
<?php
if (empty($post->post_content)) {
$post->post_content = "\n\n" ;
}
else {
$post->post_content = "\n$post->post_content" ;
}
?>
<!-- /ADDED -->


And you’re done. Each time you want to write a new post the textarea will already have the first line blanked. Same goes for existing posts you want to edit — they’re pushed a line downwards.

You’ll want to apply the same fix for the “Pages” (not just “Posts”). Locate the edit-page-form.php file within your wp-admin directory and perform the exact same steps.
Aug 27th, 2007