This topic has 3 replies, 2 voices, and was last updated 10 years by steeportaladmin.
-
Author
Tagged: pagination, page, WP-Paginate
-
September 29, 2014 at 05:29 #30041steeportaladminParticipant
Hi, Is there anyway I could configure numeric pages displayed on Kleo?
Currently I have about 180 pages – but pagination displayed on 1st page display is quite weird (only shows next page 2 and last page 180). Thus from first page, it’ll be difficult to go to page 5. I tried to solve it using WP-Paginate plugin but it does not seem to work. Any idea?
September 29, 2014 at 05:31 #30042steeportaladminParticipantScreenshot
Attachments:
You must be logged in to view attached files.October 7, 2014 at 18:54 #30997CatalinModeratorHello,
Add this to your functions.php code:
COPY CODEfunction kleo_pagination( $pages = '', $echo = true ) { $output = ''; if( $pages == '' ) { global $wp_query; $pages = $wp_query->max_num_pages; if( ! $pages ) { $pages = 1; } } // Don't print empty markup if there's only one page. if ( $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' => $pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_text' => __( '«', 'kleo_framework' ), 'next_text' => __( '»', 'kleo_framework' ), 'type' => 'array' ) ); if ( $links ) { $output .= '<nav class="pagination-nav clear" role="navigation">' . '<ul class="pagination">'; foreach ($links as $link) { $output .= '<li>' . $link . '</li>'; } $output .= '</ul>' . '</nav><!-- .navigation -->'; } if ($echo ) { echo $output; } else { return $output; }
and increase this line value:
COPY CODE'mid_size' => 1,
to a higher number.
let me know if this works.
Thank you,
CatalinHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘How to configure numeric pagination displayed’ is closed to new replies.