Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @marco87x, same problem here, did you find any workaround???

    I solved finally this way, I put here if anyone needs it (the code may be not perfect)

    <?
          //Variables
          $currentID = get_the_ID();
          $prevID;
          $nextID;
          $allID = array();
    
          //Create a query
          $theQuery = new WP_Query( 'post_type=post' );
    
          //Create the array with all the ID's
          while ( $theQuery->have_posts() ) {
            $theQuery->the_post();
            array_push($allID, get_the_ID());
          }
    
          //Check lenght of the array
          $allIDlenght = count($allID) - 1;
    
          //Check our actual ID position on the array
          $position = array_search($currentID, $allID);
    
          //If it's in the first position
          if($position === 0){
            $prevID = $allID[$allIDlenght];
            $nextID = $allID[1];
          //If it's in the last one
          }else if($position === $allIDlenght){
            $prevID = $allID[$allIDlenght-1];
            $nextID = $allID[0];
          }else{
            $prevID = $allID[$position-1];
            $nextID = $allID[$position+1];
          }
    ?>

    Hi, I’m having the same issue – my previous/next buttons to skip from one post to another don’t reflect the Anything Order plugin order of posts.

    I tried putting the above code in my functions.php but this didn’t do anyhting – should it go somewhere else?

    Here’s what me previous next links looks like:

    `<div class=”next_prev_cont”>
    <div class=”left”>
    <?php previous_post_link(‘%link’, ‘Previous<br />%title’, TRUE); ?>
    </div>
    <div class=”right”>
    <?php next_post_link(‘%link’, ‘Next<br />%title’, TRUE); ?>
    </div>
    <div class=”clear”></div>`

    @adrianperez have been struggling with this problem all day and this is a fantastic solution – thank you! Slight amends I made is WP_Query should have posts_per_page defined also needs a wp_reset_postdata(); to close.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prev Next post link not ordered’ is closed to new replies.