Pagination by week with custom query
-
Hi, may I know how can I create pagination by week, meaning the user can flip the page week by week by clicking “Next Week” , “Previous Week”.
I am using a custom loop:
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts(‘paged=’ . $paged . ‘&cat=’ . $categori .’&year=’ . $year .’&w=’ .$week );if (have_posts()) : while (have_posts()) : the_post(); ?>
<h5>
<?php if ($_GET[‘cat’] == “34” or $_GET[‘cat’] == “35” or $_GET[‘cat’] == “36”) {echo $category[0]->cat_name;} else {echo $category[1]->cat_name;} ?>
<?php echo” | “;?>
” title=”Click to read <?php the_title(); ?>”><?php the_title(); ?></h5>
<?php the_excerpt(); ?>
<div class=”meta”> </div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>and my pagination code is
<?php if(isset($paged)):?>
<div class=”navigation”>
<p class=”alignleft”><?php previous_posts_link(‘« Next Week’); ?></p>
<p class=”alignright”><?php next_posts_link(‘Previous Week »’); ?></p>
</div><?php endif; ?>How could I make the system choose to “turn the page* by week?
Thank you,
Jiew Wan
- The topic ‘Pagination by week with custom query’ is closed to new replies.