How to get the featured image outside the loop for facebook share

this is in my header

<meta property="og:image" content="<?php echo get_the_post_thumbnail($post->ID, 'thumbnail'); ?>" />

this is what is on my page so this where the featured image is taken from

while (have_posts()) : the_post(); 
   $image_share = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-share' );
   $image_post = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'counsel' );
   $image_full = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
   $comments_count = wp_count_comments( $post->ID );?>
  <h3 class="post-info-title"><p class="poster-title"><?php the_title();?></p>

  <p class="post-comment"><span class="post-comment-text">Comments</span><span class="post-commment-num"><?php echo $comments_count->approved ;?></span><img class="img-comment" src="<?php echo 'http://edge.beresponsive.net/wp-content/themes/edge-church/images/comment-img.png';?>" /></p>
  <p class="share-link-holder share-news"><a class="share-links" onclick="window.open('//player.vimeo.com/v2/video/<?php the_field('vimeo_link');?>/share/facebook', 'Facebook Share', 'width=400, height=300'); return false;" href="javascript:void(0)">Share This</a></p></h3>
  <div class="news_holder">
  <a class="news_img" href="<?php the_permalink();?>">
  </a>
  <div class="blur post-cont">
  <div class="blurb-text"> <?php the_content(); ?></div>
  </div>
  </div>

<?php endwhile; ?>>

Related posts

Leave a Reply

2 comments

  1. Print the $image into your content=””;

    $page_id = get_queried_object_id();
    if ( has_post_thumbnail( $page_id ) ) :
        $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $page_id ), 'optional-size' );
        $image = $image_array[0];
    else :
        $image = get_template_directory_uri() . '/images/default-bg.jpg';
    endif;
    <meta property="og:image" content="<?php  echo $image; ?>" />