Thanks for your questions and for all the work you’ve put into exploring the alternatives for implementing the taxonomy filtering parts of your application.
You wrote “I haven’t found anything exactly on-point, and can’t figure out how to install and use the example plugin.” I assume you mean the /examples/mla-ui-elements-example.php.txt
example plugin mentioned in earlier topics like:
Very new to this, need help
Dynamic search and filters
I know the instructions for installing the example plugin are confusing and I am working on a better process. In the interim I can send you the plugin by email in you send me your contact information. You can use the Contact Us page at our web site:
Fair Trade Judaica/Contact Us
Do not post your e-mail address in the forum; personal details in a public forum violates WordPress guidelines. I look forward to hearing from you.
To demonstrate why the example plugin would be best I will address the solutions you’ve tried so far. In you first post you gave a terms checklist and asked about changing it to a dropdown control. Your dropdown solution is close to working as you posted it.
First, when you create a checklist each term is surrounded by a link, so the mla_link_href
parameter works well. If you use mla_output=dropdown
the selected term returns a term_id value and the enclosing form provides the link. You need to replace the mla_link_href
with mla_option_value="{+slug+}"
to return the term slug instead of the term_id.
Second, the term slug will be returned in a different request variable, so you must modify your [mla_gallery]
shortcodes to look for it in the right place. You must replace attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}"
with attachment_category="{+template:({+request:tax_input.attachment_category+}|a-bad-term)+}"
in both shortcodes. The tax_input.attachment_category
request variable is the right place to look.
With those two changes the [mla_term_list]
dropdown control works with the [mla_gallery]
shortcodes, at least for single-page galleries. If the gallery has more than one page, the pagination links do not pick up the selected term.
So third, you must add the selected term to the pagination links. This requires an mla_link_href
in the second shortcode:
mla_link_href="{+new_url+}?{+new_page_text+}&tax_input%5Battachment_category%5D%5B%5D={+template:({+request:tax_input.attachment_category+}|a-bad-term)+}"
With the third change things work, more or less. The term you select doesn’t “stick” in the dropdown control, and if you page through the gallery the URLs get longer and longer with multiple copies of the selected term (that’s probably a bug which I will investigate). With all three changes your source text becomes:
<table>
<tbody>
<tr>
<td style="width: 50%;">
<form id="attachment-category-form" method="post" action=".">
[mla_term_list mla_output="dropdown" taxonomy=attachment_category number=0 mla_option_value="{+slug+}"]
<input id="submit" name="submit" type="submit" value="Search" />
</form>
</td>
<td style="width: 50%;">
[mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|a-bad-term)+}" mla_link_href="{+filelink_url+}" post_mime_type=application/pdf posts_per_page=12]
[mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|a-bad-term)+}" post_mime_type=application/pdf posts_per_page=12 mla_output="paginate_links,prev_next" mla_link_href="{+new_url+}?{+new_page_text+}&tax_input%5Battachment_category%5D%5B%5D={+template:({+request:tax_input.attachment_category+}|a-bad-term)+}"]</td>
</tr>
</tbody>
</table>
Note that I’ve also changed the form’s action="/resource-library-test/"
to action="."
which works with any page.
Your second post with the “Terms Search” alternative is really creative! As you wrote, it almost works, and I found a creative solution to the “All” problem. The search form is fine as-is. I fixed up the mla_terms_phrases
template a bit and added a second [mla_gallery]
shortcode which shows the whole gallery when both of the dropdown controls select “All”. Here’s the source text:
[mla_gallery mla_terms_phrases="{+template:({+request:form_categories+},{+request:form_tags+}|{+request:form_categories+}|{+request:form_tags+})+}" mla_term_connector="AND" mla_link_href="{+filelink_url+}" post_mime_type=application/pdf posts_per_page=12]
[mla_gallery attachment_category="{+template:({+request:form_categories+},{+request:form_tags+}|{+request:form_categories+}|{+request:form_tags+}-9999)+}" post_parent=all mla_link_href="{+filelink_url+}" post_mime_type=application/pdf posts_per_page=12]
While the two-shortcode solution works, I have to say it’s an ugly trick. The attachment_category
template returns empty when both dropdowns contain “All” and so the taxonomy filter is empty. When it’s not empty it contains a bad “term” and the filter returns an empty gallery.
As I said, the real solution is to get the example plugin up and running. I created it to solve the shortcomings of the above “solutions”. Let me help you get to the right solution for your application. Thanks for your interest in the plugin.