• Resolved redshot

    (@redshotalpha)


    I have used this plugin to filter products by category and it is really a great plugin.

    I tried to use a custom template using the custom_tpl attribute so I can modify a little bit the products displayed.

    This is the current short code that I am using:
    [woof_products per_page=6 columns=2 is_ajax=1 custom_tpl='woof_tpls/custom-product-cat.php']

    This is the code inside: custom-product-cat.php

    <?php
    	$args = array(
    		'post_type' => 'product'
    		);
    	$loop = new WP_Query( $args );
    	if ( $loop->have_posts() ) {
    		while ( $loop->have_posts() ) : $loop->the_post();
    
    			//global $product;
    			//echo $product->post->post_title;
    			//
    			wc_get_template_part( 'content', 'product' );
    
    		endwhile;
    	} else {
    		echo __( 'No products found' );
    	}
    	wp_reset_postdata();
    	
    ?>

    The output of the code above is not correct because it displays the same products from a single category for every pagination.

    Do you know that is the correct code to display the Product Title or Product Image correctly? Any idea is appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to use custom_tpl’ is closed to new replies.