Forcing 1st Image in Gallery as Featured Image
-
Dear Greg,
I am also using the “Force Feature Image” snippet and tried to make sure the first image in the gallery is used as featured-image by using the snipped you provided in this post.
Unfortunately it only uses the first (or last) UPLOADED image, but not the image manually moved to the 1st place of the gallery! … which is very different!
Intuitive would be:
1. automatically use the image from the 1st place in the gallery as featured-image (ignoring the order of the upload)
2. therefore the first place in the gallery is special and should be highlightedAny other solution is not unintuitive to lay users because they do not understand what is happening and how to open the edit-popup to mark one image to become the featured-image (which is nice for maintainers/admins).
I tried to debug and modify
function force_featured_image( $post_id ) {}
but it seems thatget_children( array( 'post_parent' => $post_id ))
does not contain the required information about the order/position of the images in the gallery.Do you have any idea, how to get the 1st image from the (possibly manually) re-ordered gallery to make it the featured-image?
thanks!
ps: i very much vote for adding this directly into wpadverts ??
The page I need help with: [log in to see the link]
- The topic ‘Forcing 1st Image in Gallery as Featured Image’ is closed to new replies.