WordPress.org

Support

Support » How-To and Troubleshooting » Script that would read the newest post onto a different page

Script that would read the newest post onto a different page

  • 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.

Viewing 1 replies (of 1 total)
  • 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):

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

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Script that would read the newest post onto a different page’ is closed to new replies.
Skip to toolbar