arrays - Wordpress: Continues(loop) page navigation with get_permalink() -


i turn page navigation in loop. i'm quit close problem i'm not able switch between categories. @ moment have loop inside of category i'm not able jump next category.

as information: have different post categories.

my script:

<?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('order' => 'desc', 'posts_per_page' => '1', 'cat=4'));  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('order' => 'asc', 'posts_per_page' => '1', 'cat=4'));  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">&nbsp;</a> </div> <div id="right"> <a href="<?php echo get_permalink($next_post_id); ?>" class="mycursornext">&nbsp;</a> </div> $query = new wp_query(array('order' => 'asc', 'posts_per_page' => '1', 'cat=4')); 

i tried different usage cat=4 or cat=1,2,3,4 has no effect.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -