Question

Hello i have one site http://anujtradingco.com/ i have created 2 pages with name rugs and bathmats and they have template as 3 col portfolio and but when eva i m clicking any of the both pages they showing whole portfolio i.e. it showing bathmats and rugs together in both pages.

mainly this line getting the post but i want to put a filter in it so kindly help me out and this is the line which getting the all post

query_posts("post_type=portfolio&paged=".get_query_var('paged'));
Was it helpful?

Solution

You can pass category-id (cat=3) if using categories such as:

query_posts("post_type=portfolio&cat=3&paged=".get_query_var('paged'));

If there are custom taxonomies (for ex: taxonomies name is 'actor') the syntax would be such as:

$args = array(
    'post_type'=> 'movie',
    'actor'    => 'Bruce Campbell, Chuck Norris',
    'order'    => 'ASC'
);
query_posts( $args );

For more you can visit: http://codex.wordpress.org/Function_Reference/query_posts

Although WP_Query is recommended approach instead of query_posts

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top