• I have been trying to use wordpress content in non-wordpress pages. PHP retrieves the posts with the query:
    SELECT post_title, post_content FROM wp_posts WHERE ID=$postno

    On closer inspection it appears most of the content in the database does not include <p> tags, relying on linebreak and return chaacters to delimit paragraphs. But some of the posts do include <p> tags.

    I recently upgraded to WP2.6, does the above suggest the database was corrupted in the upgrade?

    However, within wordpress all pages display correctly and include <p> tags. Is there some PHP function that adds the necessary formatting to the content retrieved from the database?

Viewing 1 replies (of 1 total)
  • Hi johnnyabracad,

    I just run into a similar problem and there definitely is some built-in stuff to magically convert linebreaks to paragraphs. However, it’s in general not advisable to use such a function directly (don’t know it btw) instead try to get post instances as they are delivered via the wordpress function get_posts($args) and afterwards use setup_postdata($post) to prepare the use of the_content(). The latter directly prints the desired content, including those missing paragraphs.

    I can imagine that this won’t get too easy from outside of wordpress, but this is the way I deal with it within my themes.

    Of course you can just try to mimic the same functionality by replacing linebreaks with paragraphs, but I doubt it will be easier.

    Hope this help a little,

    ~~~Cheers.

Viewing 1 replies (of 1 total)
  • The topic ‘using posts outside wordpress’ is closed to new replies.