Skip to content

Instantly share code, notes, and snippets.

@asadaly111
Last active October 27, 2016 04:52
Show Gist options
  • Save asadaly111/839cd70596ec08d7ec135d6f8ebd73b7 to your computer and use it in GitHub Desktop.
Save asadaly111/839cd70596ec08d7ec135d6f8ebd73b7 to your computer and use it in GitHub Desktop.
Multiple Feature Image in wordpress
//Three Step to go..
//1. Install the plugin called "Multiple Post Thumbnails"
https://wordpress.org/plugins/multiple-post-thumbnails/
//2. Register Feature image for post type accordingly
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Workshop Big Image',
'id' => 'workshop_big',
'post_type' => 'post'
)
);
}
//3. Past this code whereever you want
<?php
if (class_exists('MultiPostThumbnails')) :
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'workshop_big', NULL, 'secondary-featured-thumbnail');
endif;
//********************* Wordpress Default Feature imagea
//Feature Image
<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');?>
<img src="<?php echo $src[0]; ?>" alt="" title="<?php the_title(); ?>" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment