Inserting Media Search Form Into Posts Or Templates

I’ve got lots of plugin ideas but don’t have much time on developing recently, due to I’m fascinated by AngularJS since last November and prepare to grow my freelancing business. Despite that I still try to take some time to update my plugins based on suggestions from users.

Today I just pushed the latest version of Media Search Enhanced to WP.org, the major updates are inspired by a comment left here last week. Basically Don requested if I can make the plugin work on the frontend, so website visitors can search for media by all fields (title, caption, alt text, filename and terms).

I found it interesting because I’ve considered to implement functions like that but not sure if it’s of use enough. According to Don’s comment, it will be a very good idea.

So I made a major change that moved all main functions from admin class to public class in my plugin, and create a shortcode mse-search-form to insert a media search form into posts or templates. The media search form is a default WordPress search form but customized:

  1. Add a hidden field to force it only to search for attachment post type.
  2. Add a class name mse-search-form to help if user would like to modify the form with CSS.
  3. Two custom filters in the form: mse_search_form_class to change the form class name, mse_search_form_placeholder to change the input placeholder.

For now the frontend media search form might not be that helpful that it just display all media as posts in search results page. You have to custom the page to make sense of it, so maybe I should improve it in the next release by adding a media search results page or creating a media search results shortcode.

Other comments on the WP.org support forum proposed to display the media search results but group them by post id, and search for meta values. These opinions are useful to some extend so I’ll keep in mind. Your feedback is always welcome. Let’s improve the media search workflow together!

I’m a senior web developer helping clients build their websites to grow businesses. Currently I’m based in Taipei, Taiwan.

I write things about WordPress, AngularJS and life. Whenever you’d like to find someone to talk about these topics, just get in touch!

  • Media Search enhanced is a nice plugin. But if I should find it usefull myself, this is what i want:
    You should leave results with a search-field still standing, and a ‘Try a new search’.
    And you should as an administrator be able to discriminate with fields your Little search-machine will search in.
    And you should be able to make your own tags in your media – which other plugins off course do that.

    If you can do that I think you have made a very useable plugin. But for now I myself cant use it, because i wont have visiters getting all my Pictures up in a search-result – but certain pdf-files which I have tagged according to content. Can you see the problem?

    • Hi, Geert, Thanks for your feedback, I’d really appreciate it.

      Front end media search form is still not ready to use for most websites, I understand and will try to improve it as soon as I can.

      In the future releases if I add any feature per your request, I’d love to notify you and hear back from you. Stay tuned.

  • I believe this is the type of plugin I need for a current project as a “document search”. Do you have any more progress / insight on implementing this?

    Would be much appreciated!

    Thanks

    • Hey Liz,

      Just have a look at the plugin. You can easily change the code to search only for the document media type.

Submit a comment

Your email address will not be published. Required fields are marked *