WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] php and apply_filters (2 posts)

  1. klklaser
    Member
    Posted 7 years ago #

    I've been planning on upgrading from the older WordPress 1.5.X series to 2.X series one of these days. However, I'm attached to something I can easily do in the old version that's hard for me to figure out in the new version. Here's a piece of code that echoes in the administration panel of the older version just fine.

    <?php
    $content = apply_filters('the_content', $post->post_content);
    echo $content;
    ?>

    The problem is that the newer version of WordPress echoes the post content without paragraph or break marks! As near as I can tell from searching and reading this is because the filter being applied is priority 10 instead of priority 11. Whatever that means!

    Is there any 'simple' way that I can alter the above code to have $content echo with html paragraph marks and line breaks?

  2. klklaser
    Member
    Posted 7 years ago #

    Yay! This morning it occurred to me to turn off a plugin called Text Control (2.0b1 by Jeff Minard. Have no idea if its a recent version or not) and the html paragraph and break marks showed up!

    I don't think I had that plugin installed on the 1.5 blogs, it was needed in 2.0 for some special text encoding issue that I no longer recall the specifics of. Last night I did try all (or most of) the different settings it offered on the Write Post page, especially the "default" settings of "wpautop" and "wptexturize", but none of the settings I tried allowed the markup to show in source.

    Anyway, now that the html markup shows properly this allows me to custom code the post.php function with the older style "Post Preview" page which I'm quite fond of.

    The only problem will be to remember to never overwrite the customized post.php!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags