0

At present I am using the below code to navigate between previous and next post.

<?php
global $wp_query;
if (is_single()) {
    ?>
    <div class="prev-navigation">
        <?php previous_post_link('%link', '&Lang; &Lang; &Lang; %title') ?>
    </div>
    <div class="next-navigation">
        <?php next_post_link('%link', '%title &Rang; &Rang; &Rang;') ?>
    </div>
    <?php
}
?>

You can check this code at work on www.pmfias.com

  • Please can you update your question to specify what the problem is? – Tunji Dec 27 '16 at 20:25
0

Both previous_post_link and next_post_link accept a 3rd boolean parameter $in_same_term, which specifies whether link should be in a same taxonomy term.

So in your scenario you would be looking to make the following update:

previous_post_link

<?php previous_post_link('%link', '&Lang; &Lang; &Lang; %title') ?>

updated to

<?php previous_post_link('%link', '&Lang; &Lang; &Lang; %title', true) ?>

and next_post_link

<?php next_post_link('%link', '%title &Rang; &Rang; &Rang;') ?>

updated to

<?php next_post_link('%link', '%title &Rang; &Rang; &Rang;', true) ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.