• Hi, I am using get_next_post for woocommerce products. It works fine but only if I don’t add any parameter. As I want it to wrok within a product category I need to set that parameter to ‘true’, but this makes the ‘next’ link disappear…any help/idea would be super appreciated!

    My not working code is:

    <?php
    $next_post = get_next_post(true);
    if (!empty( $next_post )): ?>
      <a href="<?php echo get_permalink( $next_post->ID ); ?>">prev</a>
    <?php endif; ?>

    If I delete ‘true’ it works

Viewing 1 replies (of 1 total)
  • Thread Starter alitscha

    (@alitscha)

    quick update: I have tried with next_post_link (and previous_post_link, I need both) exactly as suggested on the Documentation page, yet it is not working, here’s the new code:

    add_action( 'woocommerce_single_product_summary', 'woa_add_product_navigation_next', 70 );
    function woa_add_product_navigation_next() {
    	?>
    	<div class="pagi-next">
    
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?> </div>
    	<?php
    }
Viewing 1 replies (of 1 total)
  • The topic ‘get_next_post parameters not working’ is closed to new replies.