Title: FB Thumbnail
Last modified: December 1, 2016

---

# FB Thumbnail

 *  Resolved [roxer82](https://wordpress.org/support/users/roxer82/)
 * (@roxer82)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/)
 * Hello,
    Great plugin! Thanks for your time. I want to use it to show a different
   thumbnail at Facebook. Here’s the code that I am using right now to show the 
   FB thumbnail:
 *     ```
       if ( has_post_thumbnail($post->ID) AND !(is_home()) ) {
       $imgfb = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
       echo "<meta property=\"og:image\" content=\"$imgfb\" />
       ";
       ```
   
 * How can I say that it should show the second thumbnail if the post has got one
   otherwise show the fist one. I was trying something link this but it doesn’t 
   work:
 *     ```
       if ( kdmfi_the_featured_image($post->ID) AND !(is_home()) ) {
       $imgfb = wp_get_attachment_url( get_post_thumbnail_id2( $post->ID ) );
       echo "<meta property=\"og:image\" content=\"$imgfb\" />
       ";
       else ( has_post_thumbnail($post->ID) AND !(is_home()) ) {
       $imgfb = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
       echo "<meta property=\"og:image\" content=\"$imgfb\" />
       ";
       ```
   
 * Thanks in advenaced!
    -  This topic was modified 9 years, 6 months ago by [roxer82](https://wordpress.org/support/users/roxer82/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Marcus Kober](https://wordpress.org/support/users/marcuskober/)
 * (@marcuskober)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/#post-8503005)
 * Hi there,
 * thank you! 🙂
 * The function kdmfi_the_featured_image() returns nothing – it just outputs the
   image as string. What you are searching for is the function kdmfi_has_featured_image().
   You can find it under FAQ: [https://wordpress.org/plugins/multiple-featured-images/faq/](https://wordpress.org/plugins/multiple-featured-images/faq/)
 * You are defining the ID of your additional featured image(s). You have to use
   this ID.
 * So the code will look something like this:
 *     ```
       if( kdmfi_has_featured_image( 'YOUR_FEATURED_IMAGE_ID', $post->ID ) && !is_home() ) {
       $imgfb = kdmfi_get_featured_image_src( 'YOUR_FEATURED_IMAGE_ID', 'full', $post->ID );
       }
       else {
       $imgfb = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
       }
       echo '<meta property="og:image" content="'.$imgfb.'"/>';
       ```
   
 * Replace YOUR_FEATURED_IMAGE_ID widht the ID you’ve chosen!
 * Hope that helps!
 *  Thread Starter [roxer82](https://wordpress.org/support/users/roxer82/)
 * (@roxer82)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/#post-8503079)
 * Thank you very muchs for your fast answer. I am having a problem. It doesn’t 
   detect the second featured imagen. How can I detect the “YOUR_FEATURED_IMAGE_ID”
   pf each post?
 *  Thread Starter [roxer82](https://wordpress.org/support/users/roxer82/)
 * (@roxer82)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/#post-8504285)
 * I just found how to do 🙂
    Thank you so much! Great plugin!
 *  Plugin Author [Marcus Kober](https://wordpress.org/support/users/marcuskober/)
 * (@marcuskober)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/#post-8505674)
 * You’re welcome! 🙂
 * A quick rating of my plugin would be nice: [https://wordpress.org/plugins/multiple-featured-images/](https://wordpress.org/plugins/multiple-featured-images/)
   
   🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘FB Thumbnail’ is closed to new replies.

 * ![](https://ps.w.org/multiple-featured-images/assets/icon-256x256.png?rev=1538365)
 * [Multiple Featured Images](https://wordpress.org/plugins/multiple-featured-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multiple-featured-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multiple-featured-images/)
 * [Active Topics](https://wordpress.org/support/plugin/multiple-featured-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multiple-featured-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multiple-featured-images/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Marcus Kober](https://wordpress.org/support/users/marcuskober/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/fb-thumbnail/#post-8505674)
 * Status: resolved