Displaying filtered posts in custom page
-
I think I am missing a critical piece of information on how WordPress works, but I don’t know what it is.
With the custom template below, I am trying to display a set of posts filtered by their category name. It works, sort of, but the link to older or newer posts does not display the next set of posts. Instead, it displays the same first posts the first page did.
How does the next_posts_link() function work? And why does it not work for me?
Thanks in advance for any illumination you can give me.
Roger
—————- page-column-archive.php
<?php
/*
Template Name: Column Archive
*/
?><?php get_header(); ?>
<?php include(‘functions/drmara-includes.php’);?>
<h1 class=”pagetitle”>Column Archive</h1>
<div id=”advice”>
<img class=”alignleft size-full wp-image-44″ title=”listen” src=”<?php echo IMAGEURL . ‘/listen.jpg’;?>” alt=”listen” width=”191″ height=”264″ />
<div style=”margin-left:206px;”>Any information </div>
<div style=”margin-left:188px;”><?php insert_cform(3); ?></div>
</div>
<?php set_filter_by_field(‘cat’,’3′); // Cat 3 is Column Archive ?>
<?php $query_text = “posts-page”; ?>
<?php query_posts($query_text); ?>
<?php global $more;?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $more = 0;?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<div class=”post-header”>
<h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
<div class=”comments”>by <?php the_author() ?>, <?php the_time(‘F j’) ?>, <span><?php the_time(‘Y’) ?></span></div>
</div><!–end post header–>
<div class=”meta clear”>
</div><!–end meta–>
<div class=”entry clear”>
<?php the_content(‘read more …’); ?>
<?php wp_link_pages(); ?>
</div><!–end entry–>
<div class=”post-footer”>
</div><!–end post footer–>
</div><!–end post–>
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
<div class=”navigation index”>
<div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
</div><!–end navigation–>
<?php else : ?>
<?php endif; ?>
</div><!–end content–>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
- The topic ‘Displaying filtered posts in custom page’ is closed to new replies.