Hot answers tagged

4

The classes added to each element in the media library grid are dinamically generated in the media-views.js file. Particularly, the code that renders the elements is part of the wp.media.view.Attachment function. It's a Backbone.js view, so it's possible to extend the library of that view in order to add the classes or other attributes you need to the grid ...


1

The WP_Query class can match IDs as well as search terms. An idea would be to use the pre_get_posts action to detect if the search term is numeric and, if it is, set the query to work with attachments while passing the search as the ID. function wpse223307_allow_search_by_attachment_id( $query ) { //Only alter the query if we are in a search screen,... ...


1

Perhaps your question no so much clear regarding your issue.I give the solution which i have understand the above question. 1. Define a query variable that indicates the requested file function add_get_file_query_var( $vars ) { $vars[] = 'get_file'; return $vars; } add_filter( 'query_vars', 'add_get_file_query_var' ); 2. Update .htaccess to ...



Only top voted, non community-wiki answers of a minimum length are eligible