Bring Your Business to Life › Support › Image Store › Filter by metadata
Tagged: filter metadata
- AuthorPosts
- March 12, 2014 at 9:29 am #57072giannyMember
It is possible to make a filter to display photos based on a filter for metadata?
Example: see all the photos that have metadata Credit = 000?
Thank you!
Gianni
March 13, 2014 at 1:00 am #57087Xpark MediaKeymasterThis is not possible by using the settings. Modifications can be made by using the plugin’s hooks.
Take a look at this hooks:
ims_pre_get_images
ims_get_gallery_imagesMarch 13, 2014 at 3:37 am #57090giannyMemberHi,
thank you for your response!In my case I need to display only photos that have metadata credit = 000
How can I change the code for this?(I’m not very experienced with php)
Thank you,
GianniMarch 14, 2014 at 12:18 pm #57099giannyMemberHelp me 🙁
March 17, 2014 at 11:40 pm #57112Xpark MediaKeymasterwhere do you need to filter the images in the front end or back end. we’ll see if we can create a simple filter.
March 18, 2014 at 12:49 am #57118giannyMemberHi @Xpark Media,
in the front-end.I simply have to display only photos that have metadata credit == 000
Thank you.
March 19, 2014 at 10:13 am #57124giannyMemberI want to apply the filter only in the front-end.
Thank you.
March 21, 2014 at 10:24 am #57136giannyMemberPlease Help me 🙁
March 22, 2014 at 4:02 am #57140Xpark MediaKeymasterAdd this code to a theme of module make sure that use a unique name for the function “MY_THEME_filter_image_by_image_meta”
function MY_THEME_filter_image_by_image_meta( ){ global $ImStore; if( empty( $ImStore->attachments ) || ! is_array( $ImStore->attachments ) ) return false; foreach( $ImStore->attachments as $key => $attachment ){ if( empty( $attachment->meta['image_meta']['credit'] ) || $attachment->meta['image_meta']['credit'] !== 000 ) unset( $ImStore->attachments[$key] ); } } add_filter( 'ims_before_galleries', 'MY_THEME_filter_image_by_image_meta' );
- AuthorPosts
- You must be logged in to reply to this topic.