Pagination only inside CATEGORY
-
Hello all!
Please somebody can help me change the code below to navigate (next/previous) only inside the category the user are in. I’m using JustWrite theme.
funcitions.php
/* Post pagination /* ------------------------------------ */ if ( ! function_exists( 'ac_post_nav_arrows' ) ) { function ac_post_nav_arrows() { global $post; $prev_post = get_next_post(); $next_post = get_previous_post(); if( $prev_post ) { $prev_post_id = $prev_post->ID; $prev_post_url = get_permalink($prev_post_id); }; if( $next_post ) { $next_post_id = $next_post->ID; $next_post_url = get_permalink($next_post_id); }; echo '<div class="post-navigation clearfix">'; if( $prev_post ) { echo '<a href="' . esc_url( $prev_post_url ) . '" class="prev-post" title="' . __( 'Previous Post', 'justwrite' ) . '">' . ac_icon('angle-left', false) . '</a>'; } else { echo '<span class="prev-post">' . ac_icon('angle-left', false) . '</span>'; } if( $next_post ) { echo '<a href="' . esc_url( $next_post_url ) . '" class="next-post" title="' . __( 'Next Post', 'justwrite' ) . '">' . ac_icon('angle-right', false) . '</a>'; } else { echo '<span class="next-post">' . ac_icon('angle-right', false) . '</span>'; } echo '</div>'; } }single.php
// Next - Previous Post ac_post_nav_arrows();Thanks!
Kind regards!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Pagination only inside CATEGORY’ is closed to new replies.