Multiple Featured Images
Enables multiple featured images for all post types (including custom post types and WooCommerce products). Comes with a widget and a handy shortcode …
Next Milestone 6K
Unlock Exact Install Count
See the precise estimated active installs for this plugin, calculated from real-time ranking data.
- Exact install estimates within tiers
- Track install growth over time
- Milestone progress predictions
Rank Changes
Downloads Growth
Upgrade to Pro
Unlock 30-day, 90-day, and yearly download history charts with a Pro subscription.
Upgrade NowReviews & Ratings
Tracked Keywords
Showing 0 of 0| Keyword | Position | Change | Type | Updated |
|---|---|---|---|---|
| No keyword data available yet. | ||||
Unlock Keyword Analytics
Track keyword rankings, search positions, and discover new ranking opportunities with a Pro subscription.
- Full keyword position tracking
- Historical ranking data
- Competitor keyword analysis
Track This Plugin
Get detailed analytics, keyword tracking, and position alerts delivered to your inbox.
Start Tracking FreePlugin Details
- Version
- trunk
- Last Updated
- Aug 20, 2020
- Requires WP
- 3.5+
- Tested Up To
- 5.5
- PHP Version
- 5.6 or higher
- Author
- Marcus Kober
Support & Rating
- Rating
- ★ ★ ★ ★ ★ 4.7
- Reviews
- 28
- Support Threads
- 0
- Resolved
- 0%
Keywords
Upgrade to Pro
Unlock keyword rankings, search positions, and detailed analytics with a Pro subscription.
Upgrade NowSimilar Plugins
Frequently Asked Questions
Common questions about Multiple Featured Images
add_filter( 'kdmfi_featured_images', function( $featured_images ) {
// Add featured-image-2 to pages and posts
$args_1 = array(
'id' => 'featured-image-2',
'desc' => 'Your description here.',
'label_name' => 'Featured Image 2',
'label_set' => 'Set featured image 2',
'label_remove' => 'Remove featured image 2',
'label_use' => 'Set featured image 2',
'post_type' => array( 'page', 'post' ),
);
// Add featured-image-2 to pages only
$args_2 = array(
'id' => 'featured-image-3',
'desc' => 'Your description here.',
'label_name' => 'Featured Image 3',
'label_set' => 'Set featured image 3',
'label_remove' => 'Remove featured image 3',
'label_use' => 'Set featured image 3',
'post_type' => array( 'page' ),
);
// Add the featured images to the array, so that you are not overwriting images that maybe are created in other filter calls
$featured_images[] = $args_1;
$featured_images[] = $args_2;
// Important! Return all featured images
return $featured_images;
});
How do I register additional featured images for WooCommerce?
The post type of WooCommerce products is "procut". So you are able to define multiple featured images as seen above, just add "product" to "post_type".
Let's say you want to add a detail image to WooCommerce products. Then this code is for you:
add_filter( 'kdmfi_featured_images', function( $featured_images ) {
$args = array(
'id' => 'product-image-detail',
'desc' => 'The detail image of the product.',
'label_name' => 'Product detail image',
'label_set' => 'Set product detail image',
'label_remove' => 'Remove product detail image',
'label_use' => 'Set product detail image',
'post_type' => array( 'product' ),
);
$featured_images[] = $args;
return $featured_images;
});
Now you are able to display the image via shortcode, widget or by including a display function (seen below) in your WooCommerce theme files.
How do I display the featured image?
Use one of the functions for retrieving the image. E.g. kdmfi_the_featured_image( 'featured-image-2', 'full'); or use the new widget "Multiple featured images" or the new shortcode!
The widget can be found under Appearance -> Widgets.
How do I use the shortcode?
Shortcode usage:
[kdmfi_featured_image id="featured-image-2" size="full"]
Possible attributes for the shortcode:
id: the id of the featured image, e.g. featured-image-2, requried
size: the desired size, defaults to "full"
post_id: the ID of the post to which the featured image is assigned, defaults to the current ID
class: the classes for the image tag, defaults to "kdmfi-featured-image"
alt: the alt attribute for the image tag, defaults to the title of the used image
title: the title attribute for the image tag, empty by default
Filter
If you need to change the image tag created by the shortcode, please use the filter "kdmfi_shortcode_html".
Example use:
add_filter( 'kdmfi_shortcode_html', function( $html, $shortcode_atts, $post_id) {
// do something
return $html;
}, 10, 3);
The filter callback gets the image tag html, the used shortcode attributes and the ID of the post where the shortcode is used.
How do I use a different size of the featured image?
Simply add the size to the function call:
kdmfi_the_featured_image( 'featured-image-2', 'full' );
You can choose every size that WordPress knows.
How can I get the ID of the featured image?
With this function call you can get the ID:
kdmfi_get_featured_image_id( 'featured-image-2' );
Note: Since a featured image has only one individual id, there is no option 'size' in this function call.
How can I get the URL of the featured image?
With this function call you can get the URL:
kdmfi_get_featured_image_src( 'featured-image-2', 'full' );
kdmfi_get_featured_image_id( $image_id, $post_id );
$post_id is optional, if you leave it out, the ID of the calling post is used.
To get the URL of the image:
kdmfi_get_featured_image_src( $image_id, $size, $post_id );
$post_id is optional (see above); $size is optional and defaults to 'full'.
To get the featured image in HTML as a string:
kdmfi_get_the_featured_image( $image_id, $size, $post_id );
Again, $size and $post_id are optional.
To display the featured image directly:
kdmfi_the_featured_image( $image_id, $size, $post_id );
Again, $size and $post_id are optional.
To check if the post has a featured image:
kdmfi_has_featured_image( $image_id, $post_id );
$post_id is optional. The function returns the id of the attachment if there's one and false if not.