Hello I’m getting closer and I can finally jum between one categorie into the next but after that it stop. So I’m still not able to loop through all the categories. I hope someone know a trick.
best, Carol
Update Code:
<?php
$prev_post = get_adjacent_post( true, '', true );
$next_post = get_adjacent_post( true, '', false );
$prev_post_id = $prev_post->ID;
$next_post_id = $next_post->ID;
?>
<?php
if(($prev_post_id === '') || ($prev_post_id === null)) :
$query = new WP_Query( array( 'category__in' => array( 2,3,4,1,5 ) ) );
if($query->have_posts()) : while($query->have_posts()) :
$query->the_post();
$prev_post_id = get_the_ID();
endwhile;
endif;
wp_reset_postdata();
endif;
if(($next_post_id === '') || ($next_post_id === null) ) :
$query = new WP_Query( array( 'category__in' => array( 2,3,4,1,5 ) ) );
if($query->have_posts()) : while($query->have_posts()) :
$query->the_post();
$next_post_id = get_the_ID();
endwhile;
endif;
wp_reset_postdata();
endif;
?>
<div id="left">
<a href="<?php echo get_permalink($prev_post_id); ?>" class="myCursorPrev"> </a>
</div>
<div id="right">
<a href="<?php echo get_permalink($next_post_id); ?>" class="myCursorNext"> </a>
</div>