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.

I am using query post in loop.php

query_posts( array('post_type'=>array('product','post'),'paged'=>$paged ) );

So that the custom post 'product' (woocommerce product) can be displayed on home page.

I am able to see 'product' & 'post' in home page of theme1 but not in theme2, what might be the problem?, suggest me place where I should check; What should I check?

share|improve this question

1 Answer 1

Here's a product loop I found:

    <ul class="products">
     <?php
    $args = array(
        'post_type' => 'product',
        'posts_per_page' => 12
        );
    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ) {
        while ( $loop->have_posts() ) : $loop->the_post();
            woocommerce_get_template_part( 'content', 'product' );
        endwhile;
    } else {
        echo __( 'No products found' );
    }
    wp_reset_postdata();
     ?>
    </ul><!--/.products-->

Maybe that will help.

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.