Thanks for starting this new topic, which looks like an update to your earlier topic:
SEARCH FORM GALLERY | ww.wp.xz.cn
In the earlier topic I wrote “You wrote that you are using a checklist, but you want to “search just images with a category applied“. I haven’t been able to get a multiple category selection to work, but if that’s vital I can investigate further.“
I will investigate further and see if I can fix the problem. My time is limited, and I appreciate your patience in awaiting progress on this topic. Thanks for your understanding.
Hi dear, thanks a lot! I’m using the checklist precisely so that the user can select different ones and what I would like to see are the images that are, for example, present in both selected categories.
Thanks for your patience while I attended to life’s many challenges. I am happy to report that I have found a solution for your application that does not require any changes to the MLA vesion you already have. Here are your shortcodes with a few modifications. I have used the “enclosing shortcode syntax” to spread the parameters across multiple lines for readability.
Also, these shortcodes use the “MLA UI Elements Example” plugin I described in your earlier “SEARCH FORM GALLERY” topic.
[mla_term_list]
use_filters=true
taxonomy=attachment_category post_mime_type=image
mla_output=checklist mla_control_name=att_category[]
mla_option_value="{+slug+}"
show_count=true pad_counts=false
[/mla_term_list]
[mla_gallery]
add_filters_to=any default_empty_gallery=true post_mime_type=image
tax_operator=AND tax_include_children=false
posts_per_page=100 mla_nolink_text="Seleziona una o più categorie per filtrare le immagini." mla_alt_shortcode=marini
[/mla_gallery]
In the [mla_term_list] shortcode the use_filters=true parameter activates the example plugin to make the term selection(s) sticky. The mla_control_name=att_category[] parameter supports multi-term selection. This shortcode must be inside an HTML form with some sort of a Submit/Search button to work.
In the [mla_gallery] shortcode the add_filters_to=any default_empty_gallery=true parameters apply the selected term(s) and show an empty gallery until one or more terms are selected. The tax_operator=AND tax_include_children=false parameters ensure that the gallery displays images assigned to ALL the selected terms. You would use tax_operator=IN to display images assigned to ANY one or more of the selected terms.
These shortcodes should give you the results you want. I am marking this topic resolved, but please update it if you have problems or further questions regarding the above solution. Thanks again for your patience and for your interest in the plugin.
Hi dear, thanks a lot for your help! Your code works really smooth! I’ve just a small question now, at this code i’ve added this
—
[mla_download_archive archive_name=”Immagini Categorie” attachment_category=”{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}” link_text=”SCARICA IMMAGINI” link_class=class=button-download elementor-button-link elementor-size-sm allow_empty_archive=false]
—
So user can download filtered images, with this new code when i click on all images will be downloaded and not just ones are displayed (so images that are in more than one category “AND”). Do you know how to fix it? Thanks!
Thanks for confirming that the suggested solution is working for you. You can match the download content to the gallery display by adding the tax_operator=and tax_include_children=false parameters to your shortcode, something like:
[mla_download_archive archive_name=”Immagini Categorie” attachment_category=”{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}” tax_operator=and tax_include_children=false link_text="SCARICA IMMAGINI" link_class=class=button-download elementor-button-link elementor-size-sm allow_empty_archive=false]
This shortcode is working on my system and should give you the results you want.
Thank you very much, this works perfectly! Really appreciate your help.