• Resolved dekap1

    (@dekap1)


    I am trying to get the older/newer entries to work for my main index page but i am having no luck. This is the template so far, what am i doing wrong?

    <h1>News & Updates</h1>
    <font size="2">

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=3&paged=$paged"); ?>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <h2>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>

    <div align="left" id="post">

    <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

    </div>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
    </div>

    <?php endif; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    Your code looks correct. Are you sure WordPress is using that template to display your posts page?

    Before that code add <!-- index.php --> and at the bottom of the page add <!-- end index.php -->

    When you are viewing the page, check View Source and make sure you see those comments in the source code. If not, WordPress is using a different template to display the page. You can use this same technique to label all your template pages with comments, thus you can tell which one is being used to display a page.

    Thread Starter dekap1

    (@dekap1)

    still does not work, when i click on older entries it still queries the same posts as page 1

    did you do what I suggested? did you see <!– index.php –> in the code when doing a View Source after making this change?

    I have helped a number of people change their query posts code to

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=3&amp;paged=$paged"); ?>

    as you have, and when it is done correctly, it eliminates the paging problem in all cases so far.

    Thread Starter dekap1

    (@dekap1)

    yes i did see the <!– index.php –> and <!– end index.php –> in the view source. sadly still no luck

    Thread Starter dekap1

    (@dekap1)

    i realized if i take out

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=3&amp;paged=$paged"); ?>

    the older/ newer entry links work fine, but once i try to implement that code, it no longer works. is there another way to query cats?

    Thread Starter dekap1

    (@dekap1)

    for anyone else having same problems… this fixed it for me

    <?php
    $limit = 6;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=3&amp;paged=$paged' . '&amp;posts_per_page=6' .'showposts=' . $limit . '&amp;paged=' . $paged);
    $wp_query->is_archive = false; $wp_query->is_home = true;
    ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Older/ Newer Entries’ is closed to new replies.