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?
- Pass PHP variable to javascript
- Plugin not showing in dashboard
- Notify commenters about new replies
- Image Crop/Resize Function/Code Sinppet/Plugin to adjust/crop images during upload
- post expire after x days
- How to handle autoloading with composer by keeping the WordPress naming conventions?
- How to structure a plugin into multiple files using classes?
- WordPress logo upload option in theme panel
- Woocommerce – Display active variation product price [closed]
- Minimum PHP Required for WordPress
- Support for simultaneous editing
- tag breaks shortcode output (other solutions don’t work)
- How can I disable widget from being visible on some pages?
- Is this the right way to execute some PHP in my plugin after a button click on an options page?
- Show Sub pages excerpt+thumbnail
- Create entire wordpress as a github repositery?
- How to overwrite core/libraries/vendor template with child theme
- Plugin integrate in forum to show user profiles [closed]
- plugin shortcode output
- how to add text to posts from tags
- Is there a WordPress plugin that can post to Google+? [closed]
- How to include this jQuery File in wordpress?
- WordPress checkbox and Illegal string offset
- dbDelta not adding additional columns in plugin database update
- Fatal error in form display plugin
- Why do plugins often ask to add in to templates?
- Is it fair to use MIT licensed code in WordPress plugins? [closed]
- Infinite scroll messing up nth:of-type
- How do I find out which plugin is exceeding memory limits?
- Taxonomy Drill-Down / Plugin Help – hierarchical queries within plugin?
- Problem installing plugin: unexpected T_STRING, expecting T_FUNCTION
- How to Show Author image and url in WordPress plugin directory? [closed]
- Renaming Custom Taxonomy Values
- Load plugin script in specific page
- jQuery code didn’t run on my plugin
- Call ajax on the frontend
- How do I profit from a Plugin?
- Color Picker UI in admin is not correct
- Can I customize an Elementor template after inserting it? [closed]
- Create automatic latest version link
- Some error in mysql script ? Can’t working to create table
- Gutenberg: Prevent links from being clickable in the block. Error: “Cannot destructure property ‘frameElement’ of ‘r’ as it is null.”
- How to Access a file that is inside a plugin’s dir from the theme’s `functions.php` file
- list of custom post by custom field in frontend
- How to add a prefix to a WordPress post preview url?
- i can not access the post in custom template of my wordpress plugin
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- Allow editor user to full permission to access plugin settings
- Change (replace) word in metabox
- Exclude Tag Links from and Text
- How to remove row action “Edit with Visual Composer” in the post list table?
- Defined user role to access plugin’s pages
- How to add wpmode in Flash Embed Code in WordPress Site?
- Better code/text editing for posts and pages?
- Saving an array to get_options
- How to change response of admin-ajax request?
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- wp plugin not working after website live
- How to add plugin to blog [closed]
- how to display the page content in popup window?
- Code snippet plugin not working correctly with Windows live writer and WordPress
- How to know if your code is executed on wordpress.com and wordpress.org?
- I want to include My theme file (testing.php) to inside my plugin folder (myplugin/mypugin.php)
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- Override plugin constant using a theme
- WordPress menu dissapear when I add a parameter to custom post archive