Support

Account

Home Forums Backend Issues (wp-admin) ACF Pro – Image from ACF Gallery as "Featured Image"

Solving

ACF Pro – Image from ACF Gallery as "Featured Image"

  • I am wondering if it is possible to set an image from the ACF gallery as the “featured image” of a post. It doesn’t have to be the WP featured image, just some way of flagging one image in the post edit screen that will allow me to set it as a featured image visually on the front end yet still be part of the gallery.

    Right now I have a gallery and the WP featured image, but I would like the images to be unified in one area on the admin edit screen and then give the user the ability to select one image in the gallery to be “special.”

    Has anyone ever done something like this? If not, I’m interested to hear other ideas that are similar.

    Thanks!
    Matt

  • There’s a somewhat unintuitive way you could do this, but I’m not sure if it’s what you’re looking for:

    You could basically use the photo description or caption to choose a featured image. For example, in your gallery, you could edit one photo that you “tag” by entering a key word in the description field… maybe “featured”.

    Then in your code, you could loop through the gallery images and when you find the image with the description “featured” you could display that and skip over all the others.

    I could supply a code snippet, but I wasn’t sure if this would be a good enough solution. I don’t know of any other way to tack on an extra checkbox on the edit window.

  • That would be a suitable approach if we weren’t going to have 100s of users editing content. If it were just me, I’d be able to control that and make sure it was always done right. Unfortunately, the user having to type something is a recipe for mistakes galore! 😀
    Either they won’t spell it right, won’t put it in the right place, will add it to one photo and forget to remove it from another, etc. etc. I guess a radio button under each photo would be the most fool-proof way of having them choose one to be the featured image.
    Unfortunately, I’m pretty new to WP development. I’m sure there’s a way to add in the radio buttons and be able to store the “featured” flag.

    Thanks!

  • @mattaton, yeah, I agree with you in that scenario. 🙂

    Sorry, I don’t really know the ins and outs of adding that to the WP core either. Sometimes I just add an ACF Featured Image and remove WP Featured Image support from the post types I don’t want them on. At least that way the image fields are together in the same place.

  • Yeah, that would probably be the fallback if I can’t figure something out. That would be a fantastic new feature to add to ACF galleries. Just some way of flagging one or more images as being “special.” And giving the option of whether one or more could be flagged. That way the theme developer can choose what to do with those special images.

    I’ll keep searching/thinking of a way to add radio buttons to the images in the meantime. 🙂

  • I regularly use the first image in the gallery for this. Depending on the site the first image is then also removed from the frontend photo gallery or slider itself if it is already shown separately on the same page.

    I do tell the owner of the site how this works but any site admin/editor/writer would figure out this logic when they first submit a draft or publish.

  • I definitely want them to be able to choose any image and still have a particular order to the gallery. That’s why the first image approach doesn’t work for me. It restricts the gallery order.

    I decided to just use the method where I add a separate ACF image field and have the gallery and image field only “see” images uploaded to the post. The user uploads to the gallery and then can select one image from the gallery as the “main image” with the image field. I think this will be the most intuitive way of doing things with the tools I have available.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘ACF Pro – Image from ACF Gallery as "Featured Image"’ is closed to new replies.