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]
- WP_Query: Why is sticky post not first item in loop?
- Most viewed post for the last 2 days using WP_Query
- Adding Post Counts to Menu (Nav) Programmatically?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Quickest way to get last or oldest post date – WP Query
- Hide Post comments when displayed via WP_Query
- Blogroll – Different layout for first post
- How do I use `posts_distinct` correctly?
- Loop through all product posts?
- How to find what index page a post is on?
- How can I sort posts by the date and a custom meta field?
- Hiding Draft Post In Admin
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How to verify wp user password by sql query in wp? [closed]
- Lost draft under all posts and drafts
- Get user categories with most posts in it
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- do more action after I publish a post
- Retrieve only posts from a specific user in wp-admin/edit.php
- Display Posts with template on a Page
- How to group only VISIBLE posts? [closed]
- Link to date_query results in WordPress
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- Display specific posts on home page
- How to display WP Query filters?
- Finding a post’s slug
- Is there a function to get post info for any publish_status by post ID?
- How Can I Always Display A Particular Post First Using WP_Query?
- Optimal WP Web App Backend for mobile app development
- Move position in post list for a custom checkbox column
- How do I display main query posts in random order using add_filter
- WordPress sorting posts by date and title using a dropdown
- query posts with selected post ids first
- Order posts inside bootstrap card columns
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Counting Posts by Category
- show image gallery in archives or category page
- Page with Category Returning 1
- Get 5 most recent categories
- Use special template for the first post in the loop
- Creating Ordered Query using Meta_key
- show latest authors blog post
- How to get only current images of a post
- Retrieve latest post by multiple categories with ID
- Update Post with Modified Data
- How to Include a common category in a custom Category Search
- wp_query posts sorting doesn’t work
- custom sort posts in archive/taxanomy page
- Trying to create shortcode listing custom posts, but formating not being included
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Get posts after calculating meta key