Add a 'Next Tag' & 'Next Month' page link
-
Possible to add a “Next Tag” and/or a ‘Next Month’ link to the archive page navigation bar?
—
An example:If you click on a tag, lets say “FURNITURE”, and on that archive page you wanted to add a link that would take you to the same archive page of the next category in your category list. So on the FURNITURE page I want a link that says “Next Tag”, etc. Same for date, just next month instead of next tag.
Here is the code for adding a ‘next category’ page link for reference (thanks alchymyth):
<?php //alchyhmyth 2011 //transformationpowertools.com/wordpress // //a simple next/prev category navigation for category archives // foreach(get_categories() as $all_cat) { $cat_ids[] = $all_cat->term_id; } $this_cat = get_query_var('cat'); $this_cat_position = array_search( $this_cat, $cat_ids ); ?> <?php $prev_cat_position = $this_cat_position -1; if( $prev_cat_position >=0 ) { $prev_cat_id = array_slice( $cat_ids, $prev_cat_position, 1 ); echo '<a href="' . get_category_link($prev_cat_id[0]) . '">? ' . get_category($prev_cat_id[0])->name . '</a>'; } ?> <?php $next_cat_position = $this_cat_position +1; if( $next_cat_position < count($cat_ids) ) { $next_cat_id = array_slice( $cat_ids, $next_cat_position, 1 ); echo '<a href="' . get_category_link($next_cat_id[0]) . '">' . get_category($next_cat_id[0])->name . ' ?</a>'; } ?>
Thanks!
- The topic ‘Add a 'Next Tag' & 'Next Month' page link’ is closed to new replies.