Filter by metadata

•

Bring Your Business to Life › Support › Image Store › Filter by metadata

Viewing 9 posts – 1 through 9 (of 9 total)
  • Author
    Posts
  • #57072
    #57087
    Xpark Media
    Keymaster

    @gianny,

    This 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_images

    #57090
    gianny
    Member

    Hi,
    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,
    Gianni

    #57099
    gianny
    Member

    Help me 🙁

    #57112
    Xpark Media
    Keymaster

    @gianny,

    where do you need to filter the images in the front end or back end. we’ll see if we can create a simple filter.

    #57118
    gianny
    Member

    Hi @Xpark Media,
    in the front-end.

    I simply have to display only photos that have metadata credit == 000

    Thank you.

    #57124
    gianny
    Member

    I want to apply the filter only in the front-end.

    Thank you.

    #57136
    gianny
    Member

    Please Help me 🙁

    #57140
    Xpark Media
    Keymaster

    Add 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' );
Viewing 9 posts – 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.