WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Conditional tags for the product category pages (2 posts)

  1. dalemoore
    Member
    Posted 9 months ago #

    I'm trying to set up a solution to change the markup of just the final product category page, that displays the results for that category.

    So if you have Shop > Category > Sub-Category > Sub-Sub-Category > Sub-Sub-Sub-Category > Single Product,
    I am wanting to manipulate just the final sub-category's template of list items. It could be two levels deep, three, four, who knows. But I always want it to be the one that lists the products, not the subcategories. Not sure if there's an "official" name for this page. But I can't find a conditional tag to target it.

    I'm aware of the ones listed at http://docs.woothemes.com/document/conditional-tags/, but is_product_category affects all of them. I only want to affect the final product_category page that actually lists the products in it. Specifically, I want the default unordered lists in all other product category pages, but in this final subcategory, I want it to be a table instead.

    Something like, adding this in loop-start.php:

    if ( is_product_conditional-that-I-dont-know() ) {
        echo '<table class="wut">';
      } else {
        echo '<ul class="products">';
      }

    would start the table if it was the final one, similar code for loop-end.php; otherwise, it would default to the unordered list. I would then add the tr's and td's into the content-product.php, which seems to control this page's output otherwise.

    Is there no conditional for this? Thanks! :)

    http://wordpress.org/plugins/woocommerce/

  2. dalemoore
    Member
    Posted 9 months ago #

    Tinkering with this some more this morning... it seems to me that is_search ought to work, since this is a search results page for that category... but it doesn't. I'm guessing because it is considered an archive instead which is why it uses the archive-product.php template... And I get why that is, because WooCommerce offers you the choice to display your products with or without the categories also listed. But, I believe there should be a way to do this...!

Reply

You must log in to post.

About this Plugin

About this Topic