I'm a product category structure where terms are expected to have several layers of children and I'm trying establish a conditional logic argument that checks against the current term's number of child terms. Here's the page in question: hidden link
Basically I want my conditional to have a statement with something like "if taxonomy term children count > 0"
Currently, I have a view that outputs the number of found terms in its output (showing 1 item per page) and I'm using that for my argument to determine the number of child terms a given term may have.
I'm getting a number output when I put my term count view outside the conditional (see attachment), however I tried various argument validations and none seem to be providing the behavior I'm looking for.
- gt '0' gets me no results
- gte '1' gets me no results
- ne '' gets me all the things regardless of number of actual terms
- ne '0' gets me all the things as well
In my screenshot, the term "Indexable" should be the only list item with visible child list elements as it's currently the only one with child terms.
Any help in this matter would be greatly appreciated. Thanks in advance!
Can you please tell me why you need conditional logic? Do you mean you want to display first category and then sub-category with its associated post count - for example:
Category 1
- sub-cat-1 (10)
- sub-cat-2 (15)
Category 2
- sub-cat-3 (1)
- sub-cat-4 (5)
Category 3
- sub-cat-5 (0)
- sub-cat-6 (2)
I need a "View All {product category name}" link nested within the child unordered list and putting that within the nested view didn't work. This is what I'm trying to achieve:
The conditional logic is necessary as there's a possibility that a product category will not have any child terms, and I need to alter the markup in accordance to that, this includes changing the parent term link from href="#" to href="[wpv-taxonomy-url]" (I just don't have that part marked up yet).
Do you mean that if the parent term does not have any child you do not want to display the "View All" term link?
Can you please share admin access details and tell me what exactly you want to hide and when and I'm happy to help you. You can share details with what term you want to display "view ALL" link and when you want to hide it or what are the conditions when you want to show/hide "View All" link.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
As you can see with the following view:
=> hidden link
I've added the shortcode attribute and also added the term url to as you can see the view's loop its adjusted as give under and removed the conditional shortcode:
Then with the "product-categories-landing-grandchildren" view I've adjusted the output of view as given under where I've added the "View All" link outside the view's loop but within the "[wpv-items-found]" section.
=> hidden link
<li class="product-cat-list-item view-all">
<a href="[wpv-attribute name='term_url']">View All [wpv-attribute name='term_title']</a>
</li>
Are those attributes standard features of Toolset's shortcodes? Could I conceivably add term_slug="" if I wanted to pull in the parent term's slug in the nested view like you did with the url and title?
Are those attributes standard features of Toolset's shortcodes? Could I conceivably add term_slug="" if I wanted to pull in the parent term's slug in the nested view like you did with the url and title?
==>
Those are shortcode arguments and you can access those shortcode argument you passed using the shortcode [wpv-attribute name='term_url']. You can pass any number of arguments as you want and catch the value of same using the shortcode [wpv-attribute].