Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.42k stars 1.99k forks source link

Add Option to Automatically set first image in post as Featured #89816

Open msilbers opened 6 months ago

msilbers commented 6 months ago

What

The option to set the first image in a post as the Featured Image is available on classic themes but we do not have an equivalent in the site editor. Ideally this option would be available at the site level, but having it as an option in Query Loop or on a template would also be good.

Why

This would be extremely helpful for people changing from older themes that supported it and folks importing from other services like Substack, which does not set Featured Images due to the export structure.

How

No response

liviopv commented 5 months ago

📌 ACTIONS

Already exists in core https://github.com/WordPress/gutenberg/issues/39170 from @davipontesblog Keeping this open to eventually track volume of requests.

katiebethbrown commented 2 months ago

We're doing this on at least one Team51 site, making use of the existing Jetpack function jetpack_featured_images_fallback_get_image, modified to remove the customizer option checks. So the dev to bring this into Jetpack/WPcom might be minimal.

https://github.com/a8cteam51/platformonomics/blob/trunk/mu-plugins/platformonomics-features/includes/class-auto-featured-image.php

Edit: looks like this is already in Gutenberg with the useFirstImageFromPost attribue, it just doesn't have a UI. So that's potentially a more robust way than what we're doing in the code above.

desnum commented 2 months ago

Just a +1 here with an example case: A user is on a classic theme only because they like that it takes the first image in the content as the featured image. They'd like a modern theme but are unsure if they would be forced to set a featured image for all 421 of their posts. Having this option in the Query Loop block would be great! zen-8621911

richtabor commented 1 month ago

@scruffian this is already possible, correct?