You can simply just add the cat
or category_name
parameter to your query. When using cat
, you should use the category ID, and should you use category_name
, it should be the slug of the category, not the name.
Change
<?php $tarali_query = new WP_Query('posts_per_page=".$nbmax."&ignore_sticky_posts=1&paged='.$paged); ?>
to
<?php $tarali_query = new WP_Query('posts_per_page=".$nbmax."&cat=CATID&ignore_sticky_posts=1&paged='.$paged); ?>
For futher reading: WP_Query
Related Posts:
- How to exclude latest x posts from a paginated query?
- Query posts distinct authors
- How to get previous 10 days post from a specific date – WP Query
- Hiding posts in a list from specified categories
- How would I get 1 latest post from a query for 5 posts?
- Exclude posts with empty post_content in wp_query
- Improving WP_Query for performance when random posts are ordered
- Reset Popular post query?
- Why WP_Query(‘showposts=5’) shows only 1 post?
- is there a way to show the the post title after the image?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Random ajax load only works with posts_per_page set to -1
- posts_per_page option limits the number of Gallery items
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- why the same code got different results when using query_posts in functions.php and index.php
- Query for first 3 posts to change the look and feel
- How to get posts published on the latest date?
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- On what hook can I get the queried object’s final state?
- wp_query with ajax
- How to give classname to post if post has no content?
- WP_Query: Show 10 posts in date order, first three random
- Random posts that always include a particular post?
- WordPress post filter menu
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- Display 3 posts with different HTML markup using a loop
- Change content off every sixth element
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- Multisite how to display merged posts from two sites and sort by latest date?
- Show 5 posts and than 3 posts offset with pagination
- wp_query args with relation
- Manipulate query to show specific post
- Sort / Filter Queries
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Remove duplicated posts in the loop if post has more than one category
- Adding a category at even positions on main loop with modified pagination
- wp_query select if have comments
- query_posts different amount of posts per page [duplicate]
- Posts – display all posts except a post by an ID
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Counter is skipping post when I still want it visible [closed]
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- query post limits
- Display posts of specific category term
- Print out last 3 blogposts
- Query posts by Author and/or by Tag
- Display Posts with template on a Page
- Archive template combined with post slider and regular posts
- Why posts array is empty?
- Can’t understand why sometimes a [caption] field appears
- How to only publish posts with image in it
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- Post Filtering by GET URL parameters
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Custom wp-query in wordpress rest api
- Get the most recently modified post date of most recently modified post
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- posts_per_page returning only one post
- Custom posts listing widget always returns 1 extra result
- If no posts exist for current day and month, show the next available day of posts
- Get post by tag
- WordPress Loop: How to display recent posts in multiple divs
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- Bootsrap carousel for post
- How to display post list in a table layout (multiple queries in single loop)
- Conflict array_splice on loop and query in widget
- All categories displays the same posts
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Get all custom posts with a certain taxonomy
- WP_Query custom field pass the post id
- How to convert query sql to shortcode in wordpress?
- Link to date_query results in WordPress
- wp_query if have posts show date but not in loop