• Resolved coldsector

    (@coldsector)


    Hello on the template i am using i have this code on the index page:

    <?php get_header() ?>
    
    <div id="container">
    <div id="content">
    
    <?php if (have_posts()) : ?>
    <?php query_posts('showposts=5'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post" id="custom_frontpage_post">
    <h1 class="entry-title"><a>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h1>
    <div class="entry-date"><?php the_time('d M, Y'); ?></div>
    <div class="entry"><?php the_excerpt(); ?></div>
    <div class="readmore"><a>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark">Read More</a></div>
    </div>
    <?php endwhile; endif;?>
    
    	</div><!-- #content -->
    </div><!-- #container -->
    <?php get_sidebar() ?>
    <?php get_footer() ?>

    With this i can show my most recent 5 posts, but i would like to have a “link” to go to older ones and from older go to recent ones, i have tryed this code:

    <div id="nav-below" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'sandbox')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox')) ?></div>
    				<div class="clearboth"></div>
    			</div>

    But when i go to “older posts” it only shows the same 5 again, i think its because of the previous code i posted. Can anyone tell me how to solve this, make 5 posts appear in the first page with excerps and “read more” but also make “older posts” appear if you press the button.

    I thank you all in advance for the help.

Viewing 1 replies (of 1 total)
  • Thread Starter coldsector

    (@coldsector)

    After some research i manage to fix this i leave here the code so it may help other with my problem.

    The only thing i needed to make was changing this:

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

    Into this:

    <?php query_posts('showposts=5'.'&paged='.$paged); ?>

Viewing 1 replies (of 1 total)

The topic ‘Help with index page code’ is closed to new replies.