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:
- Add a hidden field to force it only to search for
attachment
post type. - Add a class name
mse-search-form
to help if user would like to modify the form with CSS. - 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!
Leave a Reply