Forums

[resolved] Page of Most Recent Posts (8 posts)

  1. teckn1caLity
    Member
    Posted 8 months ago #

    How would I go about basically creating an index but on a different page? I want to display all the recent posts with pagination still working as if it were the index. I can go into more detail if need be. Thanks in advance.

  2. alchymyth
    The Sweeper
    Posted 8 months ago #

    look into using a page template http://codex.wordpress.org/Pages#Page_Templates; possibly starting with a copy of index.php.
    then add a query before the loop to catch the recent posts.
    http://codex.wordpress.org/Function_Reference/query_posts

    do you want to keep the posts on the front page as well?

    you might also want to read: http://codex.wordpress.org/Creating_a_Static_Front_Page

  3. teckn1caLity
    Member
    Posted 8 months ago #

    Where would I go about adding
    php query_posts( 'posts_per_page=5' );
    ? I'm not super familiar with php yet.

    I have everything else ready just dont know where to insert the php_query_posts ^_^

  4. alchymyth
    The Sweeper
    Posted 8 months ago #

    the loop usually starts with some code like:

    <?php if( have_posts() .....

    before that line, add the:

    <?php query_posts('posts_per_page=5'); ?>

    if that does not pull the most recent posts, you might need to expand it;
    example:

    <?php query_posts('post_type=post&posts_per_page=5&cat=0&paged='.get_query_var('paged')); ?>

    for more possible parameters, see http://codex.wordpress.org/Class_Reference/WP_Query#Parameters

  5. teckn1caLity
    Member
    Posted 8 months ago #

    This is what is currently in -

    <?php query_posts('post_type=post&posts_per_page=15&cat=0&paged='.get_query_var('paged')); ?>
    	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>

    Am I suppose to create a page template, create a page, and assign it to the template in which I have that code in?

  6. alchymyth
    The Sweeper
    Posted 8 months ago #

    Am I suppose to create a page template, create a page, and assign it to the template in which I have that code in?

    yes

    it might help if you could post a link to your site to illustrate what you have so far, and what you would like to achieve.

  7. teckn1caLity
    Member
    Posted 8 months ago #

    I got it to work, for some reason the name of the page must have been created before and it was causing a problem. Thanks for all the help I really appreciate it.

    I'm launching the site soon for everyone to see.. I've been working on it for about 2 months. A magazine site :D

  8. alchymyth
    The Sweeper
    Posted 8 months ago #

    well done ;-)

    please mark this topic as 'resolved' - thanks

Reply

You must log in to post.

About this Topic

Tags

No tags yet.