Community Forums › Forums › Archived Forums › Design Tips and Tricks › Pagination, how to increase number of pages shown?
Tagged: pagination, pre_get_posts
- This topic has 8 replies, 4 voices, and was last updated 9 years, 4 months ago by
carasmo.
-
AuthorPosts
-
June 14, 2016 at 10:49 am #187533
chriswrites
MemberI have been trying to find the answer to this but haven't had any luck, if anyone can help it ould be much appreciated.
On homepages / category pages / Archives Only a maximum number or paginated pages are shown i.e. 1 2 3 4 ... 32 Next page>I want to increase the number of pages shown ( I believe it helps search engine indexing.. reducing the amount of steps to each page) Whether you believe that or not does anyone have any ideas on how I could change it to show pages 1 - 10 instead of 1 - 4?
Thanks!!
http://chriswrites.comJune 15, 2016 at 1:52 am #187569Brad Dalton
ParticipantJune 15, 2016 at 2:03 am #187572chriswrites
MemberThanks for trying to help but there are no options to this under the content archive settings.
June 15, 2016 at 3:17 am #187575Brad Dalton
ParticipantJune 15, 2016 at 3:20 am #187577chriswrites
MemberYeah no its not there either, i was looking for info on a function, this definitely isn't part of the stock settings
June 15, 2016 at 3:34 am #187578Brad Dalton
ParticipantOctober 19, 2016 at 3:54 pm #195068blacklion
MemberI'm looking for the answer to this, too. Anybody figure it out?
October 19, 2016 at 7:46 pm #195079carasmo
ParticipantYou would unhook the
genesis_posts_navfrom thegenesis_after_endwhileusing remove action and hook in your own php, such as you could use https://codex.wordpress.org/Function_Reference/the_posts_pagination and notice the arguments, or you could copy out thegenesis_numeric_posts_nav()into your child theme, rename the function, adjust the 2 to the left and 2 to the right if the page is + 2 (see genesis/lib/structure/post.php). I would go with the standard WordPress function, much easier to mess with. Using the instructions in the codex and removing the default, the result is:/** * * Archive Pagination with mid_size increase * */ function yourprefix_archive_pagination() { echo '<div class="archive-pagination pagination">'; global $wp_query; $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big , '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'mid_size' => 5, 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query->max_num_pages ) ); echo '</div>'; } add_action( 'genesis_after_endwhile', 'yourprefix_archive_pagination' ); //* remove default archive pagination remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
October 19, 2016 at 7:49 pm #195080carasmo
ParticipantI suggest, to save a lot of grief, use FTP and a code editor (not any wordprocessor) and add this the the very end of your functions.php file outside of all other functions or use the plugin My Custom Functions. Don't use the Appearance editor.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.