• Resolved lnbbroductions

    (@lnbbroductions)


    David, let me first say that for a free plugin, this application is a masterpiece and a godsend for what it can do. The fact that you support it without even asking for direct donations is a huge testament to your altruism. Thank you.

    With that said, I’d love any help on displaying a front-end search bar for people to look up tags sourcing from the media library.

    I have looked through the documentation, and I can’t find any shortcode to display the search function itself.

    I have installed the “MLA Custom Field Search Example” and the example plugin and looked through the documentation, but I can’t find it. I apologize if this is a lot to ask for, but what shortcode do I need to use to display a search field for searching tags for the entire media library?

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

    (@dglingren)

    Thank you for your generous comments on the plugin and its support; much appreciated. You may notice the “Donations” link has returned in the latest update. It goes to charity, not to me.

    Thanks as well for your question regarding “help on displaying a front-end search bar for people to look up tags“. You have probably seen the documentation for the [mla_tag_cloud] and [mla_term_list] shortcodes, which are often used for this purpose. In addition to those tools MLA provides a “Taxonomy term keyword(s) search” feature for the [mla_gallery] shortcode which is a more direct solution to your stated goal. You can look for that section of the Settings/Media Library Assistant Documentation tab for more information. It is similar to the Keyword Search function but searches the Title field of one or more taxonomies for terms assigned to Media Library items. Here is the introduction from the Documentation section:

    Searching for keywords within the names of taxonomy terms is a completely different way to find items based on taxonomy information. Instead of matching on a slug or term-id value you can match on all or part of the term Title. The shortcode parameters in this section give you all the power of the “Terms Search” feature on the Media/Assistant submenu table, as described in the “Terms Search – filtering on taxonomy term names” Documentation section.

    You can start by adapting the “Search Form and Gallery” example (from the Documentation) to use a terms search instead of a keyword search. Try something like:

    <form id="mla-search-form" action="." method="post">
    <strong>Tags Search</strong>
    <input id="mla-search-box" name="search-string" type="text" value="">
    
    <input id="search-form-submit" name="search-form-submit" type="submit" value="Search">
    </form><strong>Tags Gallery</strong>
    
    [mla_gallery mla_terms_phrases="{+template:({+request:search-string+}|a-bad-term)+}" mla_terms_taxonomies=attachment_tag mla_term_delimiter=' ' mla_phrase_connector='OR' mla_nolink_text="Enter a search value above to display gallery."]
    

    In this example, the user enters all or part of a tag title in the text box and clicks “Search” to pass the value on to the [mla_gallery] shortcode. The mla_terms_phrases="{+template:({+request:search-string+}|a-bad-term)+}" parameter uses the passed value, when present, or substitutes an invalid term title to display an empty gallery until a term is entered.

    You have found and tried the “MLA Custom Field Search Example” plugin, which is designed to search WordPress custom fields (not your goal). You might want to explore the “MLA UI Elements Example” plugin, which adds some enhancements to the terms search function. For example, it retains the value entered in the text box when the page is refreshed with the search results. Look for the “[muie_terms_search] shortcode” in the example plugin documentation.

    Here is a more elaborate solution for your application using the example plugin:

    <form id="mla-text-form" action="." method="post">
    <strong>MLA UI Tags Search</strong>
    [muie_terms_search mla_terms_taxonomies=attachment_tag mla_term_delimiter=' ' mla_phrase_connector='OR']
    
    <input id="text-form-submit" name="text_form_submit" type="submit" value="Search">
    </form>
    <h3>Gallery</h3>
    [mla_gallery posts_per_page=20 add_filters_to=any mla_output="paginate_links,prev_next"]
    
    [mla_gallery posts_per_page=20 add_filters_to=any mla_nolink_text="Enter a term/tag keyword above to see a gallery of images that match."]
    

    I hope that gets you started on a solution 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.

    Thread Starter lnbbroductions

    (@lnbbroductions)

    David thank you so much the last thing I would ask is if its possible to add a different link to the image whenever someone trys to click on it.

    Right now the actions are typing in the search bar for the desired image using tags, the image pops up but when a person clicks it goes to the file page for that image instead of it going to a portfolio page.

    How can I choose which link for that image to go to?

    I used this code that you referenced above. You are a tremendous resource and I am very grateful that you’ve helped me this far.

    <form id="mla-search-form" action="." method="post">
    <strong>Tags Search</strong>
    <input id="mla-search-box" name="search-string" type="text" value="">
    
    <input id="search-form-submit" name="search-form-submit" type="submit" value="Search">
    </form><strong>Tags Gallery</strong>
    
    [mla_gallery mla_terms_phrases="{+template:({+request:search-string+}|a-bad-term)+}" mla_terms_taxonomies=attachment_tag mla_term_delimiter=' ' mla_phrase_connector='OR' mla_nolink_text="Enter a search value above to display gallery."]
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your positive feedback and for the additional question.

    The easiest way to change the destination of the link associated with each gallery item is to add an mla_link_href= parameter to your [mla_gallery] shortcode. You can find more information in the “Gallery Display Content” section of the Settings/Media Library Assistant Documentation tab. as it says there:

    The “mla_link_href” parameter is a great way to change the destination your gallery item links to or add arguments to the link for later processing.

    For your application, the key consideration is how you find the “portfolio page” for each gallery item. For example, if the item is “attached” to the portfolio page you can code something like:

    mla_link_href='{+site_url+}/?page_id={+parent+}'
    

    If you can give me more information about how to associate an item with its portfolio I can give you more specific guidance.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Displaying Search Gallery’ is closed to new replies.