previous & next posts with category name
-
i have a query – in the beta of the theme i have (v2,beta 4) there is a little change i would like to make to the “previous post” and “next post” section on the sidebars.
instead of saying “Previous Entry”, i want it to say “Previous (category title)” and “Next Category title”)
at the moment i have it sort of working:
<?php if ( is_single() ) { ?> <li> <ul class="sb-tools"><?php $category = get_the_category(); $cat_name = $category[0]->cat_name; previous_post_link('<li class="previous-post">%link</li>', 'Previously in '.$cat_name, TRUE, '102'); ?> <?php next_post_link('<li class="next-post">%link</li>','Next in '.$cat_name,TRUE, '102') ?> </ul> </li> <?php } ?>
i dont know enough about php to know where to put the span etc. any pointers would be appreciated.
ideally it would end up in the format:
“NEXT IN (CATEGORY)
name of post” etc.thanks in advance.
- The topic ‘previous & next posts with category name’ is closed to new replies.