• Resolved MarieDi

    (@mariedi)


    Hi,
    I’m trying to create a (hierarchial if possible) list of all media categories on my site. I see that you say the [mla_term_list] shortcode has 20 hooks, but I just can’t find them and how to create a shortcode that will simply list the names (not the images) of the media categories, ideally in hierarchical order.

    Can you help?

    It would be much appreciated.

    Thanks

    The page I need help with: [log in to see the link]

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

    (@dglingren)

    Thanks for your question. The “20 hooks” mentioned in the documentation refer to actions and filters MLA provides to let you run PHP code at appropriate points in the shortcode execution. This is an advanced feature and you can ignore it for most applications, such as your simple hierarchical list.

    You don’t say which taxonomy your “media categories” refers to, but I assume you are using the “Att. Categories” MLA provides for this purpose. Here’s an example you can start with:

    [mla_term_list taxonomy=attachment_category mla_output=ulist link=none show_count=true pad_counts=false ]

    This shortcode gives a bullet list of the “Att. Categories” taxonomy terms, with a count showing how many Media Library items are assigned to each term.

    You can adapt this example in many ways, using the parameters described in the “MLA Term List Shortcode” section of the Settings/Media Library Assistant Documentation tab.

    I will leave this topic unresolved for now, in case you have problems or further questions regarding the above example. Thanks for your interest in the plugin.

    Thread Starter MarieDi

    (@mariedi)

    Thank you so much! That is exactly what I was looking for.
    Can you tell me what “pad_counts” stands for?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for confirming that the suggestion was helpful.

    Regarding pad_counts, the WordPress Codex says “If set to true will include the quantity of a term’s children in the quantity of each term’s “count” object variable.” This parameter is used when showing a category list. When filtering a gallery display on taxonomy terms, the include_children parameter performs a similar function. The Codex says it determines “Whether or not to include children for hierarchical taxonomies.”

    You know that a hierarchical taxonomy has multiple levels of parent/child relationships. For example, you have a parent term “Animal” and child terms “Cat” and “Dog”. Some applications assign only “Cat” or “Dog” to an item, never assigning the parent “Animal”. In this case you would want pad_counts=true to get a count of the Animals and when filtering on attachment_category=animal you would want include_children=true to make sure you include the Cat and Dog items.

    If you choose to also assign the Animal term to your cats and dogs you would want pad_counts=false and include_children=false to make the counts and filtering work properly.

    I hope that gives you what you need for your application. I am marking this topic resolved, but please update it if you have any problems or further questions about displaying hierarchical taxonomy terms.

    Thread Starter MarieDi

    (@mariedi)

    Thank you so much. Very clear! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Syntax to list attachment categories’ is closed to new replies.