Sorry, my query was
query_posts( 'post_type=product&posts_per_page=3&cat=41' );
The one I posted first was an attemp to make it work.
Not sure why query posts acts weird sometimes, try:
query_posts( array (
'category_name' => 'my-category-slug',
'posts_per_page' => 3,
'post_type' => 'product'
) );
Nope. Not a thing.
I looked in the wordpress admin page and got this in the URL for the category:
wordpress/wp-admin/edit-tags.php?action=edit&taxonomy=product_category&tag_ID=41&post_type=product
So I tried adding the taxonomy as well. But nothing.
This category that I want to use ONLY belong to the ‘product’ post_type, not to the regular posts!
Can’t you use the category.php file then?
No, this is part of the header and shows only posts of this category.
It’s a section for “important” products.
For secondary loops, use get_posts instead of query_posts:
http://codex.ww.wp.xz.cn/Template_Tags/get_posts
cool! I’ll be looking at it!
Wohooo!!thanks, this was most helpfull!
$args = array(
'numberposts' => 4,
'orderby' => 'post_date',
'post_type' => 'product', //my type of post
'taxonomy' => 'product_category', //the regular categories for post_types
'product_category' => 'destacado', //The name of the regular category
'post_status' => 'publish'
);
$destacados = get_posts( $args );
foreach( $destacados as $post ) :
//... My post information here
endforeach;
With this I solved my problem! π
Hope this can help someone!
I’m closing this post!