I am trying to add a new "page" which isn't a traditional wordpress page, but just shows a list of the recent posts in the same way as an archive page. I've tried making a file called recent.php but I don't know how to call it... Alternatively I'd be happy to program it into the archive page if I just knew how. What code do I need to show all the latest posts? Is there a url that can display these? Paging doesn't work for the recent posts code I'm currently using. <?php $recent = new WP_Query("cat=recent&showposts=5"); while($recent->have_posts()) : $recent->the_post();?> Code (markup): I'm doing this for resourcebasedliving.com.
You can use the latest posts by using get_posts; full details in the wordpress codex; http://codex.wordpress.org/Template_Tags/get_posts Alternatively, use a plugin with template tags; http://wordpress.org/extend/plugins/recent-posts/
Why don't you use Smart Archieve plugin for that to show seperate page for all posts month/date wise ? DON.
Thanks but still no good. What I really just need is a way to paginate the most recent posts. I don't want to use a plugin. Surely this is a common need?
I dont understand what the problem is. If you dont want to use a plugin, then get_post as linked above - or indeed query_posts will return the number of posts you ask for. Wordpress has its own pagination built into the query_posts function but will only show 'next' and 'previos' (or more/older posts, same thing). If this is not what you are after then you just need to build your pagination around the number of results vs the number of posts shown.
Never mind, managed to find a solution (and explanation) here! http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/
Which just gives you 'next' posts links..... the exact same thing that query_posts does, as explained in my post. Why bother reinventing the wheel when wordpress does this for you already.... Given how much wordpress has changed since that was written, 2008, then are far simpler ways of doing it.