Support » Fixing WordPress » Include latest post from WordPress blog on non-WordPress PHP page?

  • Hi,

    My site runs on PHP / Smarty and I have a WordPress blog in a subdirectory.

    I’d like to be able to keep the home page as a “regular” PHP page (not generated out of WordPress) but have a block on the home page that automatically displays a snippet of the latest blog post.

    Know any easy way to do this or examples?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maybe RSS feeds?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Code like this will do it:

    include('./blog-subdirectory/wp-blog-header.php');
    query_posts('showposts=1');
    while(have_posts()): the_post();
    the_title();
    the_content();
    // whatever you want to display from the post in here
    endwhile;

    Basically, just include the WordPress code, manually specify your query, then create a normal Loop.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Include latest post from WordPress blog on non-WordPress PHP page?’ is closed to new replies.