posts_per_page & pagination conflict
Pagination is calculated before you get to the template file that runs query_posts. The proper way to alter posts_per_page conditionally is to use the pre_get_posts hook to modify the main query.
Pagination is calculated before you get to the template file that runs query_posts. The proper way to alter posts_per_page conditionally is to use the pre_get_posts hook to modify the main query.
This is the default WordPress behaviour for pagination when using a custom query (where you feed in the paged value yourself) or in the index.php as it doesn’t realize there isn’t content to display on the XXXth page until it has already loaded the template, and then tries to run the WP_Query. You can try … Read more
There where one or two problems with the code that I sorted out Big changes $number_of_terms = count( get_terms( ‘100list’ ) ); is replaced by $number_of_terms = wp_count_terms( ‘100list’ );. The reason is that wp_count_terms is already there to return the term count natively get_categories is replaced by get_terms as get_terms accepts the offset parameter … Read more
you could paginate your page by simply adding /page/n to the end of the URL, where n is the desired page number. creating your next/prev links will be a manual affair though. the page number will then be accessible via get_query_var(‘paged’). then use the number argument for get_terms to select 40 at a time, use … Read more
It’s not possible with wp_link_pages(), but you can use paginate_links(). You just need to configure the arguments so that the links are based on the pagination of your post/page. To do this you just need to know: The base URL. This is the permalink of the page/post. The format of the pagination portion of the … Read more
Your snippet is a little too verbose to follow (and it’s late here) so this is more of an alternate take. I think that forking wp_list_author() might be overkill here. It would be more elegant to hook inside user search and accurately slice the portion of authors you need. Here is some example code I … Read more
Did you actually insert the titles/thumbnails/excerpts of the subpages manually using the post editor? If so, you can place the <!–next page–> tag in between every three subpages, and they will be split into paginated sections. (Use the HTML editor to insert the tag.) Keep in mind that many people do not like pagination, so … Read more
This is the code I get from here, but I don’t remember the exact page, and this is my working page of letter B on my website (using the same code as you see below) <?php /* Template Name: Locali per lettera A WordPress template to list page titles by first letter. You should modify … Read more
You should check your code because you have some sentences that will make your pagination function returns empty value. For example, the next piece of code will get you out because you are in a page template, so is_singular() returns true: if( is_singular() ) return; Also, you are using the global $wp_query object inside your … Read more
Thanks to s_ha_dum for the tip. I managed to solve it by setting the offset parameter in the special case of 2nd page onwards for the front page as follows: function limit_posts_per_home_page() { $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $first_page_limit = 5; $limit = get_option(‘posts_per_page’); if (is_front_page()) { if ($paged == 1) { $limit … Read more