php - Woocommerce include element in products-only list page -
i need include sidebar in product list page. mean last child page there no categories or subcategories select, products. problem can't find can include code that.
there content-product.php
file generate list of products (without categories or subcategories), loop starts , ends in different files (loop-start.php
, loop-end.php
) , used both products-only loop (content-product.php
) , categories/subcategories loop (content-product-cat.php
).
i found woocommerce conditional tags checking in page in, can understand, there no possibility seperate products-only list page categories/subcategories list page these functions.
maybe had similar before , kind shere knowledge?
woocommerce have way of telling if there products shown on page. check in archive-content.php ( https://github.com/woothemes/woocommerce/blob/master/templates/archive-product.php ). basically, when you're output sidebar, add check see if there are/were posts on page. woocommerce can use have_posts(), since you'll want use sidebar after loop, you'll have manually:
global $wp_query; if ( $wp_query->post_count > 0 ) ...
Comments
Post a Comment