query_posts() overwrites the original query, and the pagination gets the original before the query_posts() call and the changed after it.
Solution: Don’t use query_posts(), filter pre_get_posts instead. We have tons of examples for that on our site. 🙂
Here is some pseudo code (meaning: not tested).
add_filter( 'pre_get_posts', 'wpse_58843_list_cat_16' );
function wpse_58843_list_cat_16( $query )
{
// make sure this matches your template’s file name.
// See http://codex.wordpress.org/Function_Reference/is_page_template
if ( ! is_page_template( 'press.php' ) )
{
return $query;
}
$query->set( 'cat', 16 );
$query->set( 'posts_per_page', 6 );
$query->set( 'post_type', 'post' );
return $query;
}
Related Posts:
- Help making my pagination plugin better
- Help With A Reverse Pagination Plugin
- How to add pagination to wpbakery grid?
- Infinite Scroll for both Index, Category and Archive
- Dropdown menu on custom page with product to choose number of products per page
- Admin Panel pagination link styles
- Pagination Broken on Static Pages but Works on Blog Articles
- Plugin dropping pagination variable
- how to use in custom single.php template using php?
- How to show only next post pagination link using wp_link_pages()
- pagination on data fetched using SQL query
- How to apply next/previous classes to LIs for pagination links?
- Replacing global wp_query
- Change the number of plugins counted on wp-admin/plugins.php
- speed up pagination for huge database
- Pagination/404 I believe wp is getting a page ahead of itself
- Pagination not working
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- How to disable Wp-PageNavi at the top of the page
- how to show all posts of each category in pages
- How to Join wp_posts & wp_postmeta table using custom query
- Enable comments pagination only amp page
- PageNavi redirects to 404 when used as archive page
- Pagination not working with pagenavi
- Ajax Load More on Hierarchical Categories
- get recent 12 days post then random in wordpress
- Wp Pagenavi how to display all results
- homepage olderposts link showing page not found
- Pagination in category
- Next and Previous Pagination button not displaying in WordPress
- WooCommerce custom query and paging: Not Found error
- Infinite scroll for text in post with url page change
- How to create load more button without a plugin?
- Registering Class methods as hook callbacks
- Output before and after the loop
- How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?
- Loading posts associated only to the logged in user on recent posts page
- Disabling Comment Notifications for Post Author
- wordpress get meta value by meta key
- Disable author pages for specific users
- Can I enable/disable/hide plugins on a per-site basis in multisite?
- Updating WordPress – the best approach (updating wp core, plugins and db)
- Code markup plugin like the .wordpress.com blogs offer?
- WordPress import does not fetch images, but just links them
- WooCommerce Always Include Shipping Information in Checkout [closed]
- Bad Request (Invalid Hostname) on working server, database problem
- How to get the current plugin name?
- Plugin throws up 404 on front-end when when enqueuing style with filetime
- Errors while using ajax from external wordpress page
- Woocommerce cart is a non-object inside `admin_post` action [closed]
- List of plugin updates in admin bar
- Peer Review Plugin for Posts? [closed]
- WooCommerce – Is is possible to replace downloadable file and allow existing customer to get it?
- Server side validation for Contact Form 7 [closed]
- How to debug register_setting callback function
- WordPress redirect all 404 pages to the Homepage
- Can I hook into get_avatar to supply a hash instead of an email?
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Recreating a local repository from a currently existing wordpress.org repo..which I own
- Bootstrap Drop Down menu is not working
- How to run subversion and staging environments when running WordPress
- WordPress get_avatar function not correct working
- Make change in media library affect images in published articles
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- UpdraftPlus installed malware – scared to download or update plugins now! [closed]
- Is there any plugin which enables users to rate comments in thumbs up-down way?
- Plugin Repostitory Questions
- Get site url and updates data, then use them
- How to update a local development plugin on a separate machine
- How do I convert my WordPress website to be domain agnostic?
- Get Image Having the ID [closed]
- Show media-uploads to all users
- I want to reset user’s post meta after successfully login
- Widget Screen Locked
- How to make a slider hearder?
- Warning: Attempt to read property “ID” on null in C:\xampp\htdocs\Nnamdi1\wp-content\plugins\elementor\core\base\document.php on line 250 [closed]
- Adding CASE in WP_Query
- why I cannot activate elementor plug in?
- How to find the following specific WordPress variables?
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- Edit plugin’s HTML output with Hooks
- How to find out programmatically whether any cache plugin is installed in the WordPress website?
- Show custom taxonomy in theme
- errno: 150 “Foreign key constraint is incorrectly formed” [closed]
- Implementation to count page visits of unique visitors based on a cookie
- How to differently style pages that display posts of different category in WordPress?
- Social sharing plugin directing to blank page after post sharing
- How to build a navigation menu for long-form texts like this one
- Like/Dislike Bar not working when updating
- how to change/remove/hide menu under installed plugins
- Simple fields plugin WordPress show repeatable file field
- Display Facebook photo albums and photo comments?
- custom registration form [duplicate]
- Detect if you’re in the “Frontend Editor” mode in Visual Composer WordPress [closed]
- How can I view the responses of contact forms on different sites in one panel or elsewhere? [duplicate]
- Page with redirect
- Why is my Gutenberg block not saving and rendering the chessboard?
- refresh media library item
- Similar hook to ‘init’ for when plugin page loads
- Elementor wp_register_script showing file when i not use ‘wp_enqueue_script’