Gallery Image Change – Function

  • Participant
    Level: Initiated
    Posts: 7
    Andrew on #16383

    Is their a function to update a gallery’s image?

    I was running MSQL functions to show me gallery images and I was attaching them to the gallery

    However I realized when I was segmenting the images I was using %LIKE and it got images that did not belong to a gallery so now I have the correct images in the gallery but lots of the gallery images are not correct.

    If possible I would like to run a function to choose a random image from the gallery and update the gallery image for a list of galleries.

  • Keymaster
    (BuddyDev Team)
    Posts: 24202
    Brajesh Singh on #16388

    Hi Andrew,
    Do you want to update the cover image?

    If yes, you can use

    mpp_update_gallery_cover_id( $gallery_id, $media_id)

    where $media_id is the id of media you want to set as gallery cover.

    You can also do it via sql. All you need to do it add the ‘_mpp_cover_id’ as the post meta for mpp-gallery post type and it’s value should be the relevant media(attachment) id.


You must be logged in to reply to this topic.

This topic is: not resolved