Skip to content

Tag Archives: article image

Add WordPress Featured Image as Automatic Facebook Like Button Image

27-Aug-11

Add the following in header.php, within the html head tag. <?php if (has_post_thumbnail() && is_single()) { // if feat im exists && current page is single article $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' ); $thumb_url = $thumb['0']; ?> <meta property="og:image" content="<?php echo $thumb_url; ?>" />