Title: Additional Featured Image Coding
Last modified: August 31, 2016

---

# Additional Featured Image Coding

 *  [rottyranch](https://wordpress.org/support/users/rottyranch/)
 * (@rottyranch)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/additional-featured-image-coding/)
 * Hi Guys
    Hope somebody can help me out a little here. Have the following code
   in functions.php, but need to add image sizing, external permalink functions 
   and image alignment to the coding. Anybody able to help me out here???
 * Its driving me up the wall. 🙁
 *     ```
       add_shortcode('thumbnail', 'thumbnail_with_caption_shortcode');
   
       function thumbnail_with_caption_shortcode($atts) {
           global $post;
           $thumbnail = get_the_post_thumbnail($post->ID);
           $thumbnail_id = get_post_thumbnail_id();
           $caption = get_post($thumbnail_id)->post_excerpt;
           $link = get_permalink($thumbnail_id);
           return '<div class="featured-image">'
           . '<a href="' . $link . '">'
           . $thumbnail
           . '<span class="caption">' . $caption . '</span>'
           . '</a>'
           . '</div>';
       }
       ```
   
 * thanks in advance
    Allan

Viewing 1 replies (of 1 total)

 *  [Drew Westcott](https://wordpress.org/support/users/drewwestcott/)
 * (@drewwestcott)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/additional-featured-image-coding/#post-6962779)
 * Hi rottyranch,
 * Your could try changing
    `$thumbnail = get_the_post_thumbnail($post->ID);`
 * to
 *     ```
       get_the_post_thumbnail( $post->ID, 'thumbnail' );      // Thumbnail (Note: different to Post Thumbnail)
       get_the_post_thumbnail( $post->ID, 'medium' );         // Medium resolution
       get_the_post_thumbnail( $post->ID, 'large' );          // Large resolution
       get_the_post_thumbnail( $post->ID, 'full' );           // Original resolution
       ```
   
 * For alignment you may want to amend or create some CSS targeting the `.featured-
   image` class.
 * Have a look at this [article](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/)
   for more info.
 * Let me know how you get on.
    Drew

Viewing 1 replies (of 1 total)

The topic ‘Additional Featured Image Coding’ is closed to new replies.

## Tags

 * [alignment](https://wordpress.org/support/topic-tag/alignment/)
 * [featured image](https://wordpress.org/support/topic-tag/featured-image/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [permalinks](https://wordpress.org/support/topic-tag/permalinks/)
 * [sizes](https://wordpress.org/support/topic-tag/sizes/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Drew Westcott](https://wordpress.org/support/users/drewwestcott/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/additional-featured-image-coding/#post-6962779)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
