Remove Last Page from Pagination Links
-
Hello,
Please help me to remove the last page from pagination links.I want to remove the very first page from pagination link structure for example I want to remove the page number 24 from Shayari.net and this is very important for me to remove.
I am currently using the following custom pagination function:
function poetry_paging_nav() { // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%'; // Set up paginated links. $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_next' => True, 'type' => 'list', ) ); if ( $links ) : ?> <div class="navigation paging-navigation"> <?php echo $links; ?> </div> <?php endif; } endif;
Please guys help me.
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Remove Last Page from Pagination Links’ is closed to new replies.