• Resolved Hearthdecko

    (@hearthdecko)


    Dear mla,

    I’m trying to get an end-user filterable gallery to work on my site and found this great info in a previous support request. This is exactly what I’m looking for but whenever I go to the front-end I only see the filter options and beneath it the [mla_gallery] shortcode is simply written as such:

    [mla_gallery post_parent=all attachment_tag=”{+request:attachment_category+}”]

    I tried all versions of the code from the earlier post and have the media_category set on my media accordingly.
    Could you please help me solve why the gallery is not displayed?

    The theme I use is Vantage by SiteOrigin and the full set of queries are below. Thanks!

    Hearthdecko

    Please select an Attachment Tag value:

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    <form id="attachment-tag-form" method="get" action="">
    	<select name="attachment_tag" class="postform">
    		<option value="">-- Select a Value --</option>
    		<option value="hunter-cards">hunter</option>
    		<option value="druid cards">druid</option>
    		<option value="another">another</option>
    	</select>
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    
    [mla_gallery post_parent=all attachment_tag="{+request:attachment_category+}"]
    
    Please select an Attachment Tag value:
    
    <form id="attachment-tag-form" method="get" action="">
    	<select name="tag1" class="postform">
    		<option value="">-- Select a Value --</option>
    		<option value="druid-cards">druid</option>
    		<option value="hunter-cards">hunter</option>
    		<option value="another">another</option>
    	</select>
    	<select name="tag2" class="postform">
    		<option value="">-- Select a Value --</option>
    		<option value="legendary-cards">legendary</option>
    		<option value="boden-canyon">Boden Canyon</option>
    		<option value="another">another</option>
    	</select>
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    
    [mla_gallery post_parent=all attachment_tag="{+request:tag1+},{+request:tag2+}"]
    
    Please select an Attachment Tag value:
    
    <form id="attachment-tag-form" method="get" action="">
    <select multiple name="tags[]" class="postform">
    	<option value="">-- Select a Value --</option>
    	<option value="hunter-cards">hunter</option>
    	<option value="druid-cards">druid</option>
    	<option value="another">another</option>
    </select>
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    
    [mla_gallery post_parent=all attachment_tag="{+request:tag1+},{+request:tag2+}"]

    https://wordpress.org/plugins/media-library-assistant/

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

    (@dglingren)

    Thanks for finding and following the earlier topic and for including a link to it from your post. It looks like you have three variations on your basic form + [mla_gallery] application, which the Moderator has combined in one code block.

    I copied your three examples into my test system and I do not see the “ beneath it the [mla_gallery] shortcode is simply written as …” symptom you reported. On my system, the gallery display appears with all of the images in my Media Library. The only reason I can think of for the [mla_gallery] text to display on your front-end page is if the MLA plugin is not installed and activated, or if some other plugin/theme is disabling the [mla_gallery] shortcode. What happens if you create a new post or page and simply add this to the content area:

    [mla_gallery post_parent=all posts_per_page=9]

    That should show up to nine of the images in your Media Library. Does that work on your system?

    Turning to your three examples, the first example has a couple of minor errors that I can see:

    1. The <option value="druid cards">druid</option> value should probably be druid-cards, because spaces are not allowed in a slug value.
    2. You have name="attachment_tag" in your form, but attachment_tag="{+request:attachment_category+}" in your shortcode. The shortcode should probably be attachment_tag="{+request:attachment_tag+}" to match the form variable.

    If you fix those errors you should get a gallery display of all your images until a term is selected; then you get a filtered gallery display. If you want to suppress the initial gallery display you can change the parameter to be something like:

    attachment_tag="{+template:({+request:attachment_tag+}|a-bad-term-slug)+}"

    Your second example looks fine. It will select all images that have the selected term(s) in either of dropdown lists. If you select two terms, i.e., a term in each dropdown, they are joined by “OR”.

    In your third example you coded name="tags[]" in the form but attachment_tag="{+request:tag1+},{+request:tag2+}" in the shortcode. If you change the shortcode to attachment_tag="{+request:tags+}" it should work.

    I hope that gets you closer to a solution for your application. I will leave this topic unresolved until I hear back from you regarding the shortcode display issue you raised and any other problems or further questions you have regarding the above suggestions. Thanks for your interest in the plugin.

    Thread Starter Hearthdecko

    (@hearthdecko)

    Hi David, thanks for coming back to me. When I paste “[mla_gallery post_parent=all posts_per_page=9]” into a new post I get te same result as previously. Do you have any idea how I could figure out what is blocking the shortcode?

    Thanks again!
    Hearthdecko

    Thread Starter Hearthdecko

    (@hearthdecko)

    Hi David, oops I misread mla_gallery for Enhanced Media Library plugin. I get the gallery now. When the page loads I see the full media library but when I apply a filter; the page reloads and no filter is applied. Full media library still on display.

    The mla settings are a bit much to take in. I applied the media_categories using the Enhanced Media Library plugin and I’m a bit lost as to the connection between the two plugins.

    Question 1: How can I display the unfiltered gallery with images from a a specific media_category instead of the whole media library?

    Question 2: How can I get the filtering to work.

    I currently use just the single filter-code but had the same result with all three options.

    Thanks again!
    Hearthdecko

    <form id="attachment-tag-form" method="get" action="">
    	<select name="attachment_tag" class="postform">
    		<option value="">-- Select a Value --</option>
    		<option value="hunter-cards">hunter</option>
    		<option value="druid-cards">druid</option>
    	</select>
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    
    [mla_gallery post_parent=all attachment_tag="{+request:attachment_category+}"]
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates on the progress you’ve made and your additional questions.

    MLA and Enhanced Media Library are separate plugins that provide enhancements to the Media Library. Both plugins add taxonomy support in similar ways. MLA provides the Att. Categories and Att. Tags taxonomies; Enhanced Media Library provides its own Media Categories taxonomy. If you use MLA’s Att. Categories you don’t need Enhanced Media Library or its Media Categories; they serve the same purpose.

    However, if you have a significant investment in assigning Media Categories you can add support for that taxonomy to MLA and continue to use it.

    1. Navigate to the Settings/Media Library Assistant General tab.
    2. Scroll down to the Taxonomy Support section
    3. Check the box in the “Support” column for your Media Categories taxonomy.
    4. Check any other options for Media Categories that you want to use. A brief description of each option is given below the table.
    5. Scroll to the bottom of the screen and click Save Changes to record your new settings.

    If you have any problems or further questions regarding the above process, let me know.

    Your “single filter-code” form is not working for the reason I gave in my earlier post:

    2.You have name=”attachment_tag” in your form, but attachment_tag=”{+request:attachment_category+}” in your shortcode. The shortcode should probably be attachment_tag=”{+request:attachment_tag+}” to match the form variable.

    The key is that the name=attachment_tag attribute must match the attachment_tag="{+request:attachment_tag+}" parameter. Of course, that assumes you are using the Att. Tags taxonomy for this example, and that “hunter-cards” and “druid-cards” are slugs for Att. Tags terms that are assigned to one or more of your items.

    If you want a form that works for Media Categories, you must first add MLA support for that taxonomy as outlined above. Then you can use a form that looks something like this:

    <form id="media-category-form" method="get" action="">
    	<select name="media-category" class="postform">
    		<option value="">-- Select a Value --</option>
    		<option value="hunter-cards">hunter</option>
    		<option value="druid-cards">druid</option>
    	</select>
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    
    [mla_gallery post_parent=all media_category="{+request:media-category+}"]

    Note that media_category is the default value for the Media Categories slug, which Enhanced Media Library calls the “Rewrite Slug”.

    I hope that gets you the results you want. I am marking this topic resolved, but please update it if you have any problems or further questions regarding custom taxonomies and the search form examples.

    Thread Starter Hearthdecko

    (@hearthdecko)

    Hi David, thanks for clearing the mla/eml confusion. I hadn’t invested in eml yet so I’ll proceed with just mla.

    I’m getting the mla_gallery now that I use the right selector (attachment_tag). A couple of new questions have risen:

    Q1. The unfiltered gallery (when the page loads) shows all media library files. Can I make it so just a certain set of media show with say a specific attachment_tag?

    Q2. The gallery shows thumbnails. How can I set these to show the full images?

    Thanks again!

    Hearthdecko

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news about your progress.

    You asked “Can I make it so just a certain set of media show with say a specific attachment_tag?” You can use a Content Template to supply an initial default tag or simply suppress the gallery entirely. Here are two examples:

    media_category="{+template:({+request:media-category+}|druid-cards)+}"
    media_category="{+template:({+request:media-category+}|an-invalid-tag)+}"

    You asked “How can I set these to show the full images?” You can use the size= parameter, as described in the Settings/Media Library Assistant Documentation tab:

    Size

    The Size parameter specifies the image size to use for the thumbnail display. Valid values include “thumbnail”, “medium”, “large”, “full” and any additional image size that was registered with add_image_size(). The default value is “thumbnail”. You can use “none” or “” to suppress thumbnail display and substitute the item title string for the image/icon.

    The [mla_gallery] shortcode supports an additional Size value, “icon”, which shows a 60×60 (or 64×64) pixel thumbnail for image items and an appropriate icon for non-image items such as PDF or text files.

    If you want to show full images you might also want to try adding columns=2 or columns=1 to allow more space for each image.

    I am marking this topic resolved, but please continue to update it if you have further questions regarding your front end filtered display. Thanks again for your interest in the plugin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Front-end filtering not working out’ is closed to new replies.