WordPress.org

Forums

Newer/Older entries link not working (3 posts)

  1. deuxanimaux
    Member
    Posted 3 years ago #

    In my posts for a category on a site, the posts 'Newer Entries/Older Entries' just send the user back to the top of the page featuring the most recent 10 posts.

    http://imageandlanguage.rca.ac.uk/category/visualities/

    The main php for that section is:

    <?php query_posts('category_name=visualities&posts_per_page=10'); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    <div class="pmEntry">
    <a>"><?php the_post_thumbnail('medium'); ?></a>
    <div class="visualitiesCaption">
    <p>
    <?php echo get_post(get_post_thumbnail_id())->post_content; ?>
    </p>
    </div>
    </div>
    
    </div>
    
    <?php endwhile; ?>
    
    <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    
    <?php else : ?>
    
    <h2>No Posts Yet</h2>
    
    <?php endif; ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Any tips to help me please? I've checked everything I could. My understanding of php is very basic & I've checked reading settings etc...
    Thank you!

  2. paulwpxp
    Font hero
    Posted 3 years ago #

    Review this
    http://codex.wordpress.org/Pagination#Adding_the_.22paged.22_parameter_to_a_query

    and just so you know, TEMPLATEPATH is deprecated, still usable but better not.

  3. Ravinder Kumar
    Member
    Posted 3 years ago #

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts('category_name=visualities&posts_per_page=10&paged='.$paged); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    <div class="pmEntry">
    <a>"><?php the_post_thumbnail('medium'); ?></a>
    <div class="visualitiesCaption">
    <p>
    <?php echo get_post(get_post_thumbnail_id())->post_content; ?>
    </p>
    </div>
    </div>
    
    </div>
    
    <?php endwhile; ?>
    
    <?php get_template_part('inc','nav' ); ?>
    
    <?php else : ?>
    
    <h2>No Posts Yet</h2>
    
    <?php endif; ?>

    Try it but before make backup of original file nav.php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.