WordPress.org

Ready to get started?Download WordPress

Forums

Include latest post from WordPress blog on non-Wordpress PHP page? (3 posts)

  1. endloser
    Member
    Posted 5 years ago #

    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!

  2. moshu
    Member
    Posted 5 years ago #

    Maybe RSS feeds?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic