Support » Fixing WordPress » Adding Excerpts to a Page Outside of WordPress

  • fx3000

    (@fx3000)


    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • moshu

    (@moshu)

    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.

    fx3000

    (@fx3000)

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

    WordPress Rocks!

    moshu

    (@moshu)

    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');

    davidchait

    (@davidchait)

    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

    moshu

    (@moshu)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding Excerpts to a Page Outside of WordPress’ is closed to new replies.