WordPress.org

Forums

Media Library Assistant
[resolved] Front-End Search by Keyword (6 posts)

  1. nythemes
    Member
    Posted 1 year ago #

    Hello,

    I'm try to create a list (gallery) of documents with a front-end search form by keyword capability. That will return documents that contain the keyword either in the doc file title, description, ..etc

    Something similar to what this plugin does: media category library

    I was wondering if it is possible to do something like this with the MEDIA LIBRARY ASSISTANT plugin? And if so, could someone guide me a little in the right direction. I have started with this code in my page template, but it just lists ALL documents.

    <form id="attachment-tag-form" method="get" action="">
    
    <input type="text" name="attachtag" id="attachtag" ><br/>
    
    	<input type="submit" id="submit" name="submit" value="GO">
    </form>
    <?php $tag = $_REQUEST['attachtag'];
     echo  $tag;
    ?>
    	  <div class="mla-tags-gallery">
    				<?php echo do_shortcode('[mla_gallery  post_mime_type=application link="file" size=icon category="federal" taxonomy="media-category" mla_caption="{+title+} {+description+} {+date+}" s="{+request:$tag+}" ]' ); ?>

    thank you

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

  2. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you for your interest in the plugin and for this question. I am traveling until 2/10, with limited internet access, but I can give you a few pointers now and more when I return home.

    You are on the right track, but the shortcode parameters need some adjustment. If you are looking for the term "federal" in the taxonomy "media-category", the parameter would simply be media-category=federal. This assumes you have set up a custom taxonomy called "media-category". If you are using the MLA "Att. Categories" taxonomy the taxonomy name would be "attachment_category".

    For the keyword search parameter, the proper code would be s="{+request:attachtag+}". The "request" prefix will look for the variable "attachtag" in the$_REQUEST` array; the intermediate step is not required.

    I believe this combination of parameters will restrict your search to items that match both the taxonomy parameter and the keyword parameter.

    You might try experimenting with just the s= parameter or just the taxonomy parameter and verifying that each part of your request is working the way you expect. You can also add mla_debug=true to display a large (and ugly) amount of debugging information that will show you the query parameters, SQL clauses and so forth.

    I hope that gets you going towards your goal. I will leave this topic unresolved for now. Please update it with any further problems or questions, but understand that there may be a delay in my response.

  3. nythemes
    Member
    Posted 1 year ago #

    thank you David for the quick reply,
    that certainly sparked a lightbulb, I think I got it working now.
    Thank You Again

    ziemowit

  4. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you for your update and the good news. I am going to mark this topic resolved, but please update it if you have any problems or further questions.

  5. bcrigler
    Member
    Posted 1 year ago #

    @nythemes - Can you please post your working version for others. I am trying to accomplish a front end search via Media Library Assistant as well and would be interested to see what you came up with. Thanks!

  6. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    I have just posted a simple example of a "front end search" using [mla_gallery] with a simple HTML form. Have a look at this support topic and see if it inspires you:

    How to display PDF files

    The example appears towards the bottom of the topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Media Library Assistant
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic