• Resolved dooza

    (@dooza)


    Hi! I am struggling to work out how to get keyword search implemented on a page with the gallery shortcode. Are there any examples for me to follow?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dooza

    (@dooza)

    After reading the support docs I managed to find this and get it working:

    <form id="mla-search-form" action="." method="post">
    <input id="mla-search-box" name="search-string" type="text" value="" placeholder="Keyword search" />&nbsp;<input id="submit" name="submit" type="submit" value="Search" />
    </form>

    [mla_gallery link="file" columns="4" attachment_category="aluminium-frame-marquees" style="random" s="{+template:({+request:search-string+})+}" mla_nolink_text="No images found." main_size="full" tile_size="gallery_thumb"]

    My only question remaining is how can I get the form field to show what was searched for?

    Steve

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for the work you’ve done to find a solution. Thanks as well for posting the complete source text of your form and the shortcode on your page; very helpful.

    You asked “how can I get the form field to show what was searched for?” Pressing the “Search” button refreshes the page, which sets the text box back to its initial value. There’s nothing in the core MLA plugin to fix this, but an example plugin has been developed for several earlier topics that will add this feature among many others.

    To use the additional features you must install and activate the example plugin. Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “UI” in the text box and click “Search Plugins” to filter the table.

    You are looking for the “MLA UI Elements Example” plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and verify or activate the example plugin as you would any other plugin.

    Once the example plugin is installed and active you can go back to your application page and modify the shortcodes to use the new feature. Here is the updated text that is working on my test system:

    <form id="mla-search-form" action="." method="post">[muie_keyword_search muie_attributes='placeholder="Keyword search"' ] <input id="submit" name="submit" type="submit" value="Search" /></form>
    <p>[mla_gallery link="file" columns="4" attachment_category="aluminium-frame-marquees" style="random" add_filters_to=any mla_nolink_text="No images found." main_size="full" tile_size="gallery_thumb"]</p>
    

    In the form I have replaced the text box control with the [muie_keyword_search] shortcode. In the [mla_gallery] shortcode I have replaced the s= parameter with add_filters_to=any, which populates the s= value with the content of the [muie_keyword_search] shortcode.

    You can find more information in the Settings/MLA UI Elements Documentation tab.

    I hope the changes and the example plugin will give you the results you need. I will leave this topic unresolved in case you have problems or further questions regarding the above suggestions.

    Thread Starter dooza

    (@dooza)

    @dglingren that is perfect! Thank you very much, my client will be very happy.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Frontend keyword search’ is closed to new replies.