Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Ok I'm using the plugin "The Cart Press" and I am trying to understand how multiple loops work when using a custom post type.

If I do a regular query for posts it just gives me back my blog posts and not my TCP products. When displaying products regularly they use the same loop functions as blog posts and so I'm wondering what is happening differently to cause these products to be loaded.

I have used a portfolio plugin in the past called "Simple Portfolio" which has a custom function called simple_portfolio_get_projects() which just gives me an array of projects and I would like to be able to do the same with TCP products.

share|improve this question
    
The code you are using for the loops, especially the queries, would be useful. –  toscho Nov 6 '12 at 11:19
    
Currently I am just using the regular loop. It uses its own taxonomy www.example.com/product_category/category-slug to list the items and then www.example.com/product/product-slug for the product. But inside the page for a single product I want to be able to show all other products in the same category. –  Jacob Tomlinson Nov 6 '12 at 11:27

1 Answer 1

I've managed to do it by setting the post type when I make the query

$my_query = new WP_Query( array("post_type" => "tcp_product"));
if ( $my_query->have_posts() ) { 
    while ( $my_query->have_posts() ) { 
        $my_query->the_post();
        the_title();
    }
}
wp_reset_postdata();
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.