Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    I dont think you can do it with next_post_link. try it with get_adjacent_post.
    something like this:

    <?php
    $next_post = get_adjacent_post( false, '', false );
    $previous_post = get_adjacent_post( false, '', true );
    if($previous_post) : ?>
    <a href="<?php echo get_permalink($previous_post->ID); ?>?new=1"><?php echo get_the_title($previous_post->ID) ?></a>
    <?php php endif; ?>
    <?php if($next_post) : ?>
    <a href="<?php echo get_permalink($next_post->ID); ?>?new=1"><?php echo get_the_title($next_post->ID) ?></a>
    <?php php endif; ?>

    Hi traumm, instead of next_post_link, have you tried the get_next_posts_link function? I believe this is a similar thread:

    [resolved] Next and Previous Posts URLs

    Moderator keesiemeijer

    (@keesiemeijer)

    Even better imh_brad!

    Thread Starter traumm

    (@traumm)

    I ended up get_adjacent_post in the end – it’s working fine now!

    Thanks both!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Append a variable to next_post_link URL’ is closed to new replies.