page 1 is not paged

do you mean you want a conditional for page 1 of all home queries which have more than one page as result? try to use $wp_query->max_num_pages; example: if (is_home() && $wp_query->max_num_pages > 1 && !is_paged()) echo ‘/page/1’; else echo “https://wordpress.stackexchange.com/”;

Pagination Adding Numbers in Strange Fashion

What you are seeing, I believe, is a result of paginate_links using three blocks of numbering– first, middle, and last. If you had enough pages you’d get, for example, when browsing page 50 … 1 2 3 … 49 50 51 … 98 99 100 If you imagine the “middle” numbers overlapping the “first” numbers … Read more

Pagination for normal (standard) posts on a page with a custom loop?

get_pagination_links is looking at $wp_query, whereas you want pagination for your query object named $loop. So instead, use paginate_links Something similar to this code, which is based on get_pagination_links, alebit with wp-query swapped out for your loop query object: $endsize = $midsize = 1; $type=”plain”; $loop->query_vars[‘paged’] > 1 ? $current = $loop->query_vars[‘paged’] : $current = … Read more

paginate_comments_links() not working

paginate_comment_links() actually does some magic setup for comments and then calls the standard wordpress paginate_links(). I believe that part of that magic utilizes the result of wp_list_comments(). So even though your code is works great – you cannot use the built-in paginate comments functionallity because you are not using wp_list_comments(). And you can’t use that … Read more

Pagination breaks on child-categories, works fine on parent-category

I was finally able to get this working! Here’s how: What I had misunderstood (being a WP noob and all…) is that get_query_var(‘page’) is for pages, and get_query_var(‘paged’) is for posts. http://codex.wordpress.org/Function_Reference/get_query_varfor So I replaced these two lines $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; // FOR PAGINATION ‘page’ => $paged, // FOR PAGINATION with … Read more

Pagination for multiple queries merging into one Loop

Firstly you need to merge your two query into one, and need to use WP_Query instead of get_posts: $paged = 1 ; $posts_per_page = 10 ; $args = array( ‘post_type’ => ‘espresso_event’, ‘meta_key’ => ‘event_start_date’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ => $posts_per_page, ‘paged’ => $paged, ‘meta_query’ => array( array( ‘key’ => ‘event_registration_end’, ‘value’ … Read more

Ending Pagination loop in PHP

You could try ‘total’ => min(5,$wp_query->max_num_pages), Edit: In the source code for paginate_links http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/general-template.php#L1922 the links are displayed in a loop with $n = 1; $n <= $total; $n++ and since %#% is replaced with $n my idea is to limit the number of displayed pagelinks by restricting $total to the minimum of 5 and … Read more

Error 404 on pagination on homepage

To understand why 404 erros occur with pagination, you have to first understand the process WordPress follows when a page is requested. The query is parsed and the results are queried from the database before the template is loaded. When you create a new query in the template, these results are unrelated to the original … Read more

Trouble Making WP_Query paged

Pagination in URLs only works for the “main” query. What you’ve created is a secondary query, so WordPress doesn’t “know” about it in such a way that the application would be able to create pagination. If you use a secondary query (like your example) it’s up to you to do the pagination stuff manually. Rather … Read more

error code: 521