• Sorry if this question is in the wrong section, I wasn’t sure.

    What would be the best way to make a very simple page that isn’t the index, which could display just the last five or eight posts. No widgets, no sidebar, nothing extra, other than what would sort of be the main body on an index page. Just the title, author, date, story, number of comments, maybe tags, for the most recent group of posts?

    I’m trying to find the most efficient way to display recent posts on a non-WP portion of a site and I’m thinking using something like this as an include might be best? I’m open to suggestions though.

    I don’t really want to have to use an RSS reader as a module to display my own WP section articles, but I haven’t figured out what would be better. Any suggestions would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • In my opinion using the RSS feed would be the best option and write some PHP on your separate page to display this so it is completely independent from your WordPress installation.

    If you do not wish to do it this way I would recommend creating a page in your admin and assign it a custom page template. Then create a custom page template in your themes folder with the WP_Query loop to show the latest posts. Then just include the URL of that page. If you just want the list without the header and footer of your website just don’t include get_header and get_footer on that custom page.

    For more information on WP_Query visit http://codex.wordpress.org/Function_Reference/WP_Query.

    Hope this helps.

    Dave.

    Here some sample code, which might be helpful and get some basic idea.

    include("blog/wp-load.php");
    $recent_query = new WP_Query("posts_per_page=5");
    $recent_blogs = array();
    while($recent_query->have_posts()) {
       $recent_query->the_post();
       array_push($recent_blogs, array('link'=>get_permalink(), 'title'=>get_the_title(), 'excerpt'=>strip_tags(get_the_excerpt())));
    }

    Point the include statement to your exact wp-load.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simply last X posts on a seperate clean page?’ is closed to new replies.