Support » Plugin: Media Library Assistant » [mla_term_list]: parent count to include children

  • Resolved alx359

    (@alx359)


    I’ve an mla_term_list tree widget filled with terms from the attachment_category taxonomy. I’ve a cosmetic issue (the tree itself works fine otherwise). When terms are parents of children, their children items are not being counted as belonging to their parent. For example:

    <li class="cat-item cat-item-209 current-cat active has-child">
        <a href="https://www.domain.com/craftwork/prints/" title="0 items">Prints</a>
        <button class="toggle"><i class="icon-angle-down"></i></button>
        <ul class="children"><li class="cat-item cat-item-216">
            <a href="https://www.domain.com/craftwork/prints-a3/" title="149 items">A3 Prints</a>
            </li>
            <li class="cat-item cat-item-217">
            <a href="https://www.domain.com/craftwork/prints-a1/" title="145 items">A1 Prints</a>
            </li>
        </ul>
    </li>

    Note how cat-item-209 a markup says title="0 items", despite it being the parent of cat-item-216 (149 items) and cat-item-217 (145 items). I need a way cat-item-209 a title to spell the sum of its own items (zero in this case), but plus those from its respective children, i.e 294 items total in this case. How to achieve that?

    Here’s my shortcode:

    [mla_term_list taxonomy=attachment_category orderby=term_order mla_markup=term-list-flatsome exclude_tree=226,213,227,18089,18112]

    and the relevant term-list-flatsome markup

    Arguments:

    current_item_class="current-cat"
    active_item_class="active"
    my_current_item=true
    mla_style=none

    Item:

    <[+termtag+] class="cat-item cat-item-[+term_id+] [+current_item_class+] [+active_item_class+]">[+termlink+]
    	[+children+]
    </[+termtag+]>

    Thank you.

Viewing 1 replies (of 1 total)
  • Plugin Author David Lingren

    (@dglingren)

    Good to hear from you again, and thanks for your question.

    I believe you can get the results you seek by adding a parameter to your [mla_term_list] shortcode. Here’s the relevant excerpt from the Documentation tab:

    pad_counts – True to include the count of all children in their parents’ count. The default, “false”, does not include children in their parents’ count.

    You can add pad_counts=true to your shortcode or to the Arguments section of your template. I am marking this topic resolved, but please update it if you have problems or further questions regarding the suggested solution. Thanks for your continued interest in the plugin.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.