Genesis Featured Images
Output featured images on selected post types #
The genesis-singular-images
post type support enables output of featured images and adds Customizer options to show images on supported post types.
Add support for each post type like this:
add_post_type_support( 'post', 'genesis-singular-images' );
add_post_type_support( 'page', 'genesis-singular-images' );
When adding genesis-singular-images
post type support to a post type other than 'post' or 'page', you must also add custom-fields
support to your custom post type: add_post_type_support( 'your-type', 'custom-fields' );
This ensures the “hide featured image” option appears in the Genesis editor sidebar when editing your post type.
Adding genesis-singular-images
support results in these options in the Customizer at Theme Settings → Singular Content:
For entries using the block editor, users also gain an option in the Genesis sidebar to hide images in the Genesis editor sidebar:
Change the image output position #
When each “show featured images” option is checked, Genesis will output the images for you via the genesis_entry_content
hook. Adjust the image output position like this:
remove_action( 'genesis_entry_content', 'genesis_do_singular_image', 8 );
add_action( 'genesis_[your_choice]', 'genesis_do_singular_image' );
Change the image size #
Images use the archive image size from Theme Settings → Content Archive → Featured Image Size by default. Theme developers can set a default image size for all singular featured images by adding a custom image size to their theme:
add_image_size( 'genesis-singular-images', 200, 300, true );
And override that for specific post types:
add_image_size( 'genesis-singular-image-[type]', 600, 300, true );
A genesis_singular_image_size
filter is available to override the image size.