• Resolved starslikedust

    (@starslikedust)


    This code worked perfectly before I updated to 4.2.2:

    <?php echo next_post_link('%link', '? Previous '.$animal,true); ?> <a href="<?php echo get_permalink(40); ?>">Adopt Home</a> <?php echo previous_post_link('%link', 'Next '.$animal.' ?',true); ?>

    It will work now but only when ‘true’ is deleted. Otherwise nothing is returned. It is required that the next and previous links must be from the same category so ‘true’ needs to work.

    Getting a little desperate here after trying to fix over the past week.

    Thanks for any help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator t-p

    (@t-p)

    what theme are you using?

    Thread Starter starslikedust

    (@starslikedust)

    To make this question more clear.

    This code worked before updating to 4.2.2. It displays the link to the next post in the category.

    <?php echo next_post_link('%link', '? Previous '.$animal,true); ?>

    Since updating, it does not. I had to delete “true” to make it work at all. But now the next link display is simply whatever post is next regardless of the category.

    <?php echo next_post_link('%link', '? Previous '.$animal); ?>

    Ack!

    Thread Starter starslikedust

    (@starslikedust)

    I am using a custom theme based on TwentyTen. Thanks!

    Moderator t-p

    (@t-p)

    Twenty Ten theme for the next_post_link shows something like this:

    <?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>

    there is no “true” in it.

    By the way the latest Twenty Ten version is 1.9

    Thread Starter starslikedust

    (@starslikedust)

    Perhaps I used the wrong term when I said my theme is “based on”. My theme is stand-alone and does not refer to TwentyTen at all. But, when I’m testing the site I usually go back to TwentyTen. Hope that’s clear =)

    Please see https://codex.www.ads-software.com/Function_Reference/next_post_link

    Moderator t-p

    (@t-p)

    My theme is stand-alone and does not refer to TwentyTen at all. But, when I’m testing the site I usually go back to TwentyTen. Hope that’s clear =)

    – For questions regarding your custom theme, please contact its designer/developer. You’ll be more likely to find a good answer from them, for they have the access to its code. Forum volunteers are not given access to custom theme, so they would not know why your “stand-alone” theme is not working properly. The vendors are responsible for supporting their product. These forums are for free themes available in the WordPress theme directory at www.ads-software.com/themes/. See https://codex.www.ads-software.com/Forum_Welcome#Commercial_Products

    Thread Starter starslikedust

    (@starslikedust)

    I am the designer. I’ve been through the codex and the only way to display links that have the same category is by using the argument ‘true’. Why it doesn’t work now is a mystery. Thanks, anyway.

    Moderator t-p

    (@t-p)

    You are welcome ??

    Thread Starter starslikedust

    (@starslikedust)

    With all due respect, the theme I am using is not a commercial theme I am not a vendor. I created the theme using the WP Codex for a non-profit animal rescue. If you’d like access to my code, you are welcome to it.

    Another member asked the same question 2 years ago:
    “I can get the previous and next button links to work perfectly fine ONLY when $in_same_cat is set to FALSE. If I set it to TRUE (which is what I want) the links do not work.”

    There was no resolution. I have researched this problem extensively in WP Support Forums, in the Codex and on the web in general and after a week I am no nearer a solution than I was at the beginning.

    By the way, the posts I’m concerned with are Custom Post Types.

    Thank you for your attention.
    Karen.

    Thread Starter starslikedust

    (@starslikedust)

    Turned out the taxonomy for this function on my site is “genre” not “category”. I inherited the site. So it was all about determining the correct term.

    Moderator t-p

    (@t-p)

    Glad you got it sorted ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘next_post_link not working since update to 4.2.2’ is closed to new replies.