WordPress.org

Forums

Adding Excerpts to a Page Outside of WordPress (6 posts)

  1. fx3000
    Member
    Posted 8 years ago #

    I would like to add excerpts of my latest posts to my home page which is a static page outside of my WordPress pages. Is there a way to do this? I guess I probably could turn my home page into a WordPress "page", but I would rather find a way that I could call WordPress functions on a page outside the WordPress system.

    Thanks!

  2. moshu
    Member
    Posted 8 years ago #

    If that file is a .php file - just put this at the top of it (before everything else)
    <?php
    require('./wp-blog-header.php');
    ?>

    and then you can use any WP function in that file, including plugins (e.g. recent posts), The Loop, template tags etc.

  3. fx3000
    Member
    Posted 8 years ago #

    It would indeed be a .php file, so I will give this a try.
    Thanks a lot, moshu.

    WordPress Rocks!

  4. moshu
    Member
    Posted 8 years ago #

    Oops! I forgot to tell you but hopefully you figured out:
    include the correct path to where your WP install is! i.e.

    require('./path-to-your-blog/wp-blog-header.php');

  5. davidchait
    Member
    Posted 8 years ago #

    or, if you don't want the overhead of loading up the entirety of WP every time your home page loads, you can use something like CG-FeedRead to grab your own RSS entries, and display them on your homepage. That way the stuff is cached, only 'loads' WP as part of a request for the feed (once every N hours), minimal impact on your main page load time.

    -d

  6. moshu
    Member
    Posted 8 years ago #

    Yes, that's even better - especially if you just want to display some posts/excerpts.

Topic Closed

This topic has been closed to new replies.

About this Topic