Help on query_posts() Show only specific category (4 posts)

  1. flicker07
    Posted 4 years ago #

    Hello to all,

    i have this query_posts which displays 8 videos of all category
    query_posts( array ( 'posts_per_page' => 8, 'post_type' => 'portfolio' ) );

    how can i modify it and add condition that it will only display a specific category. Category ID is 5 for example.?

    Thanks a lot :)

  2. keesiemeijer
    Posted 4 years ago #



    query_posts( array ( 'posts_per_page' => 8, 'post_type' => 'portfolio' , 'cat' => 5) );
  3. esmi
    Forum Moderator
    Posted 4 years ago #

    query_posts( array ( 'cat' => 5, posts_per_page' => 8, 'post_type' => 'portfolio' ) );

  4. flicker07
    Posted 4 years ago #

    Hello, i tried the codes you've given however it doesn't work. ahmmm. maybe because it is not a post. actually this a custom page which is portfolio. In portfolio i made this entries not on page or posts. we all know that page doesn't have any category that's why i used portfolio to sort things up.
    any more suggestions?

    Thanks a lot for your responses :)

Topic Closed

This topic has been closed to new replies.

About this Topic