If you are using the “Att. Tag” taxonomy built in to MLA then your shortcode should be something like:
[mla_gallery attachment_tag=background post_parent=all]
In this example, attachment_tag
is the WordPress taxonomy name or “slug” for the taxonomy. If you’re using “Att. Category, the slug would be attachment_category
.
Give that a try and let me know if you still have problems or more questions. Thanks for your interest and for using the plugin.
Thread Starter
Joe
(@timelessbeing)
Yes, that worked. I was going by examples that I found in the help documentation, which is a bit confusing. You should make it a clearer to user that “attachment_tag” is the correct paramater to use with your plugin’s built-in tagging function.
Thanks for your help.
I’m glad you’ve found your solution.
You’re right; the documentation was (more than) a bit confusing. I’ve improved it for future releases. Thanks for pointing this out.
Thread Starter
Joe
(@timelessbeing)
can I do a query for multiple tags, where the attachment matches all of them?
Yes! You can use the full power of WordPress’ tax_query
, as documented in the codex:
Class Reference/WP Query
Here is an example along the lines you want:
[mla_gallery tax_query="array(array('taxonomy' => 'attachment_tag','field' => 'slug','terms' => array( 'artisan', 'attention' ), 'operator' => 'AND' ))" post_parent=all]
This is a powerful, but somewhat tricky, capability. If you make the slightest mistake in your query string it will fail (and expose an MLA bug which I will fix in a future release; thanks).
Some tips: 1) code your query on a single line; no line breaks inside the string, 2) do NOT use the “Visual” editor; use the “HTML” or “Text” editor to prevent the “>” from becoming an HTML escape sequence (ampersand gt semicolon).
I hope this meets your needs. Thanks for a great question and for using the plugin.
Thread Starter
Joe
(@timelessbeing)
OK, I tried it and I’m glad that works. Thanks. It’s rather cryptic, though. A comma-separated list would be loads more user-friendly.
Thread Starter
Joe
(@timelessbeing)
Also, if you do any editing in ‘Visual’ mode afterward, it breaks all your MLA image galleries.
Yes, the visual editor is always “improving” the text by inserting line breaks, converting HTML special characters to escape sequences, etc. I will revisit this issue for a future release and see if I can clean up the visual editor damage.
The tax_query and meta_query parameters are very powerful, but (as you said) cryptic. You can use a comma-separated list, but the operator
defaults to OR
. The Codex says that this simple form is also:
Deprecated as of Version 3.1 in favor of ‘tax_query’.
Adding a parameter such as tax_operator=AND
might be useful; what do you think?
Thread Starter
Joe
(@timelessbeing)
If I could do:
[mla_gallery attachment_tag=commercial,boardroom tax_operator=AND ... ]
that would be just fine. I’ll try it and let you know…
Just to be clear, tax_operator
is a new idea, not something already implemented in the 1.13 release.
I have just completed some enhancements to clean up the Visual editor damage and to implement the tax_operator
. If you want to get an updated version and try it out, send me your e-mail address and I will send you the latest code. Go to the “Contact Us” page at our web site:
Fair Trade Judaica/Contact Us
Thanks for bringing thse ideas to my attention and for your continued interest in the plugin.
Thread Starter
Joe
(@timelessbeing)
Your code fix works great. Looking forward to the next release 🙂
I have released version 1.14, which includes the new tax_operator
parameter for the [mla_gallery]
shortcode. Thanks for the suggestion and for testing the pre-release code.