paginate_links WP function

So the purpose of the function is not that hard: generate a set of URLs of a total size with current page and some pretty parts. The issue is that the way URL is configured is quite… original and documentation doesn’t quite describe what happens accurately. The documentation implies that these are default base and … Read more

Content only on last page, if the page has pagination

Instead of using the global variables directly, here’s a way to use the content_pagination filter to add custom HTML to the last content page: /** * Append HTML to the last content page, if it’s paginated */ add_filter( ‘content_pagination’, function( $pages ) { if( count( $pages ) > 1 ) $pages[count($pages)-1] .= ‘<div>MY HTML HERE!</div>’; … Read more

How to add pagination to comments?

Put below code into your current theme’s comments.php file: <div class=”navigation”> <?php paginate_comments_links(); ?> </div> <ol class=”commentlist”> <?php wp_list_comments(); ?> </ol> <div class=”navigation”> <?php paginate_comments_links(); ?> </div> This code will display pagination as you expect. Don’t forgot to check the break comment to part with number of settings from Admin > Settings > Discussion Settings. … Read more

I want to change the media list with additionally query

As said in comments, it’s not a good idea editing WP core files. You can easily modify the query that displays your media posts by adding the following code to a plugin or your theme’s functions.php add_filter( ‘pre_get_posts’, ‘_wp_media_pre_get_posts’ ); function _wp_media_pre_get_posts( $wp_query ) { global $pagenow; if( ! in_array( $pagenow, array( ‘upload.php’, ‘admin-ajax.php’ ) … Read more

Pagination – Posting First Page Content

Try to update index.php template with new WP_Query arg paged. The code should be: <?php $paged = isset(get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $news_query = new WP_Query(array( ‘post__not_in’ => array($featured_post->ID), ‘paged’ => $paged )); More info in codex

Remove pagination from WooCommerce product categories on admin edit navigation menus

Based on “Remove Pagination in Appearance -> Menus -> Categories“ answer thread for WordPress categories, you will adapt the answer code to WooCommerce Product Categories. The taxonomy of WooCommerce Product category is product_cat. Is also better to target admin nav menus only. Try the following (untested): add_filter( ‘get_terms_args’, ‘admin_nav_menu_show_all_product_categories’, 10, 2); function admin_nav_menu_show_all_product_categories( $args, $taxonomies … Read more

add spans and characters into paginate_links

The function paginate_links() can return “plain”, “list” and “array” (http://codex.wordpress.org/Function_Reference/paginate_links). Just define the type as array then you’ll be to display it as you want: <?php global $wp_query; $big = 999999999; // need an unlikely integer $paginate_links = paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, get_pagenum_link( $big ) ), ‘format’ => ‘?paged=%#%’, ‘current’ => max( … Read more

Limit the number of pages created by the paging

This seem to work. Put in your functions.php: add_filter(‘pre_get_posts’, ‘limit_pages’); function limit_pages($query) { $query->max_num_pages = 5; if ($query->query_vars[‘paged’] > 5) { $query->query_vars[‘paged’] = 5; $query->query[‘paged’] = 5; } return $query; } But I guess you would still need some workaround for posts pagination and authors. Hope it helps you a little.