Pagination per month with custom date field
-
I’m trying to understand how to make a custom pagination.
What I need is this:< January >
I have posts under the category ‘news’, so I have to show them with pagination.
I get the month from a custom field called ‘event_date’.I need that when the user clicks the arrows, the pagination shows the posts of the next/prev month, and the text changes for that month.
Any help will be so appreciated!
So far I got this:<?php $args = array( 'category_name' => 'news', 'posts_per_page' => 20, 'paged' => $paged ); $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query($args); ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <li> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> <div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div> </div> <?php $wp_query = null; $wp_query = $temp;?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination per month with custom date field’ is closed to new replies.