I have a thing like this:
<nav class="prev-next margin-t-20 float-left">
<?php
$args = array(
'post_type' => 'work',
'orderby' => 'menu_order'
);
$prev_post = wpqpapl($post->ID, $args, 'previous', 'ID');
$next_post = wpqpapl($post->ID, $args, 'next', 'ID');
?>
<div class="next-link margin-r-20 dehighlight">
<?php if ( !empty( $next_post ) ) { ?>
<a id="next-link" href="<?php echo get_permalink( $next_post ); ?>">←</a>
<?php } else { ?>
←
<?php } ?>
</div>
<div class="prev-link dehighlight">
<?php if ( !empty( $prev_post ) ) { ?>
<a id="prev-link" href="<?php echo get_permalink( $prev_post ); ?>">→</a>
<?php } else { ?>
→
<?php } ?>
</div>
</nav>
I check if $next_page
and $prev_page
have something in them and display an arraow (← or → ) inside a link to a next post.
When it gets to the last post, the previous
returns nothing, like it should, cause there is no previous posts. But when it gets to the first post, the next
returns the current page.
Is it just me or a bug? (probably just me)
https://www.ads-software.com/plugins/wp-query-powered-adjacent-post-link/
]]>hi,
thank you for this plugin – i ve searched for this option, because previous_next_link only shows listed elements by chronical sort.
i tried this plugin but i got on most of items the error message “wpqpapl:Error:4”.
i tried inside and outside of the loop. some items worked, some not.
please, could you give me another example for using this? maybe a complete loop with wp_query function?
thank you.
regards
andrej
https://www.ads-software.com/extend/plugins/wp-query-powered-adjacent-post-link/
]]>