Pagination of posts
-
Hi
WP novice, my site is: http://www.drummondclinic.co.uk/
My Blog pages show at most is set to 10 and this is sufficient for most purposes but it means that readers do not have access to older posts. For the Articles and Blog pages I want to introduce pagination but I cannot find any documentation to lead me through this process.
I managed to find some code in the forums that introduced the 1.2.3.Next text to the bottom of the 10 posts, but I didn’t know if it needed any customisation…when I clicked on an additional page I got a 404 error.
This was the code I added<?php global $wp_query, $wp_rewrite; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; $pagination = array( 'base' => @add_query_arg('page','%#%'), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'show_all' => true, 'type' => 'plain' ); if( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ); if( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) ); echo paginate_links( $pagination ); ?>I put this into the articles.php
In fact I have just put it back in again so you can see the result:
http://www.drummondclinic.co.uk/articles/Is anyone able to direct me to the relevant documentation/forum post or offer advice to lead me through?
Thanks in advance.
K
The topic ‘Pagination of posts’ is closed to new replies.