Script that would read the newest post onto a different page (2 posts)

  1. Bartholomew Esq.
    Posted 8 years ago #

    I would like to read a small quip from the latest post on my blog, unto a different part of my website (non-blog).

    Is there an easy way to do this with WordPress? Or do I really have to go through the hassle of setting up a RSS reader, just for this function?

    I'm hoping it could be done in either PHP or JS.

  2. scribblerguy
    Posted 8 years ago #

    To gain access to the WordPress engine on a non-WP page, make that a PHP file and include the following line (though you may want to add some error handling):


    Then you can use a query_posts() call with a Loop.

    The main drawback to the above solution is that you'll be invoking the entire WP engine, though that would still happen with an RSS solution (unless you're using Feedburner or a similar service.

    The best solution (if you know PHP and SQL) would be to write a simple script that pulls the info you want straight from your WP database.

Topic Closed

This topic has been closed to new replies.

About this Topic