Enables multiple featured images for posts and pages.
You can call new kdMultipleFeaturedImages( $args ); multiple times with different arguments in $args.
For expample:
$args1 = array(
'id' => 'featured-image-2',
'post_type' => 'post', // Set this to post or page
'labels' => array(
'name' => 'Featured image 2',
'set' => 'Set featured image 2',
'remove' => 'Remove featured image 2',
'use' => 'Use as featured image 2',
)
);
$args2 = array(
'id' => 'featured-image-3',
'post_type' => 'post', // Set this to post or page
'labels' => array(
'name' => 'Featured image 3',
'set' => 'Set featured image 3',
'remove' => 'Remove featured image 3',
'use' => 'Use as featured image 3',
)
);
new kdMultipleFeaturedImages( $args1 );
new kdMultipleFeaturedImages( $args2 );
Simply add the size to the function call:
kd_mfi_the_featured_image( 'featured-image-2', 'post', 'full' );
You can choose every size that WordPress knows.
With this function call you can get the ID:
kd_mfi_get_featured_image_id( 'featured-image-2', 'post' );
Note: Since a featured image has only one individual id, there is no option 'size' in this function call.
With this function call you can get the URL:
kd_mfi_get_featured_image_url( 'featured-image-2', 'post', 'full' );
If you need the ID only, use this function:
kd_mfi_get_featured_image_id( $image_id, $post_type, $post_id );
$post_id is optional, if you leave it out, the ID of the calling post or page is used.
To get the URL of the image:
kd_mfi_get_featured_image_url( $image_id, $post_type, $size, $post_id );
$post_id is optional (see above); $size is option and defaults to 'full'.
To get the featured image in HTML as a string:
kd_mfi_get_the_featured_image( $image_id, $post_type, $size, $post_id );
Again, $size and $post_id are optional.
To display the featured image directly:
kd_mfi_the_featured_image( $image_id, $post_type, $size, $post_id ) {
Again, $size and $post_id are optional.
Requires: 2.9.2 or higher
Compatible up to: 3.3.2
Last Updated: 2012-5-31
Downloads: 13,689
1 of 6 support threads in the last two months have been resolved.
Got something to say? Need help?