Thanks you for your good words regarding the plugin and for your question. Thanks as well for including the full source text of your shortcodes; very helpful.
Here are updated shortcodes that are working well on my test system:
[mla_tag_cloud taxonomy=attachment_tag post_mime_type=application/pdf minimum=1 mla_link_href="{+page_url+}?current_id={+term_id+}&mla_cloud_current={+template:({+request:mla_cloud_current+})|1+}" style='masonry' separator=" · " smallest=12 largest=12]
[mla_gallery post_mime_type=application/pdf tax_query="array ( 'relation' => 'AND', array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+template:({+request:current_id+})|1+} ), 'include_children' => false ), array ( 'taxonomy' => 'attachment_category', 'field' => 'slug', 'terms' => 'abc', 'include_children' => false ) )" posts_per_page=10 mla_caption="{+title+}" columns=5 size=icon link=file ]
[mla_gallery post_mime_type=application/pdf tax_query="array ( 'relation' => 'AND', array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+template:({+request:current_id+})|1+} ), 'include_children' => false ), array ( 'taxonomy' => 'attachment_category', 'field' => 'slug', 'terms' => 'abc', 'include_children' => false ) )" posts_per_page=10 mla_output="paginate_links,prev_next"]
My changes are:
- I added
post_mime_type=application/pdf
and minimum=1
to block 1. This restricts the cloud display to those terms that have one or more PDF documents assigned to them. I regret that there is no explicit way to further restrict the cloud to terms within a single category.
- I added a second element to the tax_query,
array ( 'taxonomy' => 'attachment_category', 'field' => 'slug', 'terms' => 'abc', 'include_children' => false )
, to restrict the gallery display and pagination controls to items assigned to the ‘abc’ term in the attachment_category
taxonomy. You can adapt this element to the term you want.
- I added a
'relation' => 'AND'
element to the tax_query so items must have both the ‘abc’ term and the term from the cloud to be displayed.
- I have changed the
attachment_terms
value to {+template:({+request:current_id+})|1+}
so the gallery will be empty until a cloud term is clicked.
- I ensured that the data selection parameters for block 2 and block 3 are identical, so the controls will match the gallery display.
- I removed the
columns=5
parameter from the pagination controls, which do not use this parameter.
You can restrict your tag cloud, block 1, to terms assigned to item having attachment_category=abc
by adapting a two-step shortcode combination:
[mla_gallery post_mime_type=application/pdf post_parent=all category=abc mla_alt_shortcode=mla_tag_cloud mla_alt_parameters="taxonomy=attachment_tag mla_link_href='{+page_url+}?current_id={+term_id+}&mla_cloud_current={+template:({+request:mla_cloud_current+})|1+}' style='masonry' separator=' · ' smallest=12 largest=12"]
In this alternative the [mla_gallery]
shortcode selects all PDF documents assigned to attachment_category=abc
and then passes a list of their ID values as an ids=
parameter to the alternate shortcode, [mla_tag_cloud]
. The cloud then displays only those terms assigned to one or more of the items in the list. You can find more information in the “Support for Other Gallery-generating Shortcodes” section of the Settings/Media Library Assistant Documentation tab.
I hope that gets you started on a solution that works for your application. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.