wordpress display posts from specific category on page

The argument isn't category, it is cat. Your query fails because you are using an argument that doesn't exist.

$args = array(
  'post_type' => 'post' ,
  'orderby' => 'date' ,
  'order' => 'DESC' ,
  'posts_per_page' => 6,
  'cat'         => '3',
  'paged' => get_query_var('paged'),
  'post_parent' => $parent
); 
$q = new WP_Query($args);
if ( $q->have_posts() ) { 
  while ( $q->have_posts() ) {
    $q->the_post();
    // your loop
  }
}
Notice that I have converted your query_posts() into a new WP_Query object. Do not use query_posts(), ever. Even the Codex states so.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination). Any modern WP code should use more reliable methods, like making use of pre_get_posts hook, for this purpose.

http://codex.wordpress.org/Function_Reference/query_posts

Also note that I removed unnecessary PHP opening and closing tags and formatted the code for better readability. That alternative control structure syntax is a formula for failure, in my experience.

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
display post of specific category in wordpress development display post of specific category in wordpress show posts of one category wp wp only show posts list of certain category show posts from specific category wordpress get posts of particular category in wordpress how to show specific post content in category page on wordpress wordpress get posts of certain category for a theme how to show some particular category post in wordpress home page PHP Display Posts by Category in WordPress Display Posts by Category in WordPress wordpress display 2 category posts on page display specific category post in wordpress wordpress how to display category of the post wordpress how to display category posts on a page display of posts page wordpress wordpress display other posts from same category how to show category post show on page wordpress page to display category posts wordpress wordpress widget posts from category display posts under different category wordpress display posts in different category wordpress display category of posts wordpress wordpress view posts by category wordpress show category posts on page custom wordpress widget so show posts from specific category show specific category post wordpress How to Display Category name Posts on WordPress Pages How to Display Category Posts on WordPress Pages show posts in category with a tag wordpress wordpress list of posts on page by category wordpress.com show posts category wordpress query only posts from category wordpress get posts by category python wordpress display category and posts wordpress php get posts of specific category wordpress display realted post with category show all posts of a specific category on the home page in wordpress theme wordpress get posts in category wordpress posts from all category wordpress category show all posts show posts by category wordpress get posts based on category wordpress display posts by category wordpress on different page wordpress load posts from category wordpress page posts specific category wordpress show all posts in category page wordpress show posts from category on page theme development wordpress show all posts from category on page wordpress show posts from category on page display category posts on page wordpress Display posts by category WordPress on a page how to display category posts in wordpress page display posts from category wordpress how to display post from specific category wordpress show posts from specific category wordpress blog page show post from specific category wordpress show posts from specific category wordpress plugin wordpress only show posts from specific category wordpress get posts of category display posts by category wordpress wordpress show posts on page by category in custom wordpress display popular posts on page by category wordpress display posts on page by category wordpress display posts from specific category on page
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source