How to set pagination to work with ‘/page/’?
When the pagination format is /something/page/2/, the query var is paged. page is the query var for singular post pagination in the format /something/2/.
When the pagination format is /something/page/2/, the query var is paged. page is the query var for singular post pagination in the format /something/2/.
You are doing the right thing. In theory you can probably intercept the “normal” API request and modify the relevant wp_query to whatever you need, but this will mean that you are changing and overriding that API and if you will need it in its “virgin” form at some point it will not be available. … Read more
You have to install Yoast SEO and then add to functions.php: function return_canon () { $canon_page = get_pagenum_link(1); return $canon_page; } function canon_paged() { if (is_paged()) { add_filter( ‘wpseo_canonical’, ‘return_canon’ ); } } add_filter(‘wpseo_head’,’canon_paged’);
After some messing around (and actually looking at the docs properly!) I have solved the problem. In my routing, I just need to add another map to handle paging with my custom routing: Routes::map(‘items/browse/:field/:value’, function($params) { $query = array( ‘post_type’ => ‘item’, ‘meta_key’ => $params[‘field’], ‘meta_value’ => $params[‘value’] ); Routes::load(‘archive-item.php’, $params, $query); }); Routes::map(‘items/browse/:field/:value/page/:page’, function($params) … Read more
The root problem, as you can see here, resides in the fact that WP counts items (terms) to paginate this way: ‘total_items’ => wp_count_terms( $this->screen->taxonomy, compact( ‘search’ ) ), Instead, it should count terms from the result of the query. I believe this is an issue and that it should be reported on WP bug … Read more
As an update. It turns out that what I’m trying to do is outside of RSS’s specification. So the short answer is “don’t do that, use an API”. But had I wanted to hack around that spec, I could Use the Custom Permalinks plugin Go back to the default permalink mode in the site’s settings … Read more
You won’t get a 404 because WP can find the page, and it then delegates the request to the template file where you added your own logic. You could build your own 404 handling in that file, but a better way is to use a the archive.php (or archive-post.php for just this post type) to … Read more
Don’t use a hyphen in the shortcode name. See https://codex.wordpress.org/Shortcode_API#Hyphens .
I found the final answer here: https://wordpress.stackexchange.com/a/217534/77722 Page 2 of front page was taking pagination from main query, not from my custom query. I’ve taked these actions: 1. To change name of front-page.php to index.php in order to get the main query every time page is loaded (even when paginated) 2. To change main query … Read more
posts_nav_link() just outputs get_previous_posts_link() and get_next_posts_link() with a separator between them. The helpful thing is does is handle the visibility of the separator depending on whether both pages exist. Since you always want to show something on either side, you don’t need it. What you can do is output the next and previous links manually, … Read more