Support » Fixing WordPress » How is post formatting done?

  • Resolved MrBobDobolina


    Okay, I have my blog but it’s separated from my main website (in a different subdomain.) Anyway, I would like to make it so the newest post always shows up on the main page. As of right now I have played with just connecting to the database and grabbing the needed info, but the main content of post contains no line breaks or returns.

    I know this is must be done via the PHP, but I can’t find where. Is it possible for me to tap into the function that formats the paragraph breaks in? If so, how?

    Another option I have thought of would be *simply* set up a page on my blog, similar to a “single post” without the header, comments, sidebar, etc… and do an include of that into my home page. My only problem with that is that I don’t know what functions are being called for in all the related documents that I would be ignoring.

    Any suggestions, comments, and/or questions would be most appreciative. Thanks a ton!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    You don’t need to access the database directly. You can use wordpress to do it all.

    In your external PHP page, just do:

    This includes all of the basic WordPress functionality. Then you can do something like this:

    $posts = get_posts( "numberposts=1" );
    if( $posts ) {
    foreach( $posts as $post ) {
    setup_postdata( $post );
    the_time('M d');
    ...whatever else you like...

    And so on. Including the wp_blog_header gives you the full wordpress suite. It won’t actually display the blog itself unless you do a define(‘WP_USE_THEMES’, true) first.

    Thank you kindly!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How is post formatting done?’ is closed to new replies.