wp_pagenavi() with custom wp_query()?
wp_pagenavi( array( ‘query’ => $loop ) ); should work with the code above. Don’t hijack the main query if you can avoid it.
wp_pagenavi( array( ‘query’ => $loop ) ); should work with the code above. Don’t hijack the main query if you can avoid it.
Have you tried: The main one: add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]’, ‘top’ ); For pagination add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/page/([0-9]{1,})/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]&paged=$matches[3]’, ‘top’ ); Out of curiousity, I replaced one of the ([^/]+) with the literal ‘type’ since that doesn’t seem to be a dynamic variable. If the pagination doesn’t work, try switching the order of when it’s declared, i.e. before … Read more
I believe you could just call the paged add_rewrite_url last so that it is checked first. Otherwise the paged version will never get any match, since the non-paged one will always match first. Should also work if you remove ‘top’ from your arguments. Also, check out this page for a nice way of debugging those … Read more
If you check out the source, they’re both wrappers around *_posts(), which in turn are wrappers for get_*_posts_page_link() (where the wildcard indicates either next or previous). For example, next_posts() will echo or return the escaped URL, depending on the first argument: $escaped_url = next_posts( false /* Don’t echo */ ); next_posts(); // Prints escaped URL … Read more
Ok, I found the solution in terms of getting the links to appear, however, I needed to remove the ‘true’ argument for only moving between posts in the same category/taxonomy. Is that right that you can’t restrict the posts linked to so that they’re only the ones within the same taxonomy? Here’s the correct code … Read more
I hope you understand what query variables is. If not, here is it in short. The main query uses WP_Query to set itself up. In the main query, WP_Query uses public query variables to construct the main query according to the page being requested, and paged and page are two of them. To see all … Read more
Building off of what Rarst has said, I’m pretty sure the query string will retain ‘paged’ queries even if WP_Query strips it out as irrelevant. You could try replacing your query posts line with this: global $query_string; parse_str( $query_string, $my_query_array ); $paged = ( isset( $my_query_array[‘paged’] ) && !empty( $my_query_array[‘paged’] ) ) ? $my_query_array[‘paged’] : … Read more
twentyeleven_content_nav() uses the main query object, $wp_query. You’ll need to use the $wp_query variable, rather than $unfiltered_query, then wp_reset_query() to restore the original $wp_query (which it’ll find in $wp_the_query, something you should probably avoid touching directly). As long as you’re careful to restore the original query, you’re in good shape. I would submit a patch … Read more
WordPress doesn’t automatically add all query string params ($_GET params) as query_vars. When Query Var somevar is not registered: example.com/some-page/?somevar=hello – WordPress ignores somevar When Query Var somevar is registered: example.com/some-page/?somevar=hello – WordPress stores the value of this param in the $wp_query->query_vars array The difference between registering that variable with WordPress is whether the value … Read more
Update I’ve tested this and it works on my site. A few things: Replace my $query with yours global $wpdb (per your comment regarding global variables) since it’s out of scope! get_results() returns an object when not told otherwise (second parameter is the return type) I placed this in a plugin, but you could extract … Read more