Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function tnc_share_image_fix(){
- if(has_post_thumbnail()){
- $thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 600,315 ), false, '' );
- echo '<meta property="og:image" content="'.$thumb_url[0].'" />';
- } else {
- echo '<meta property="og:image" content="'.get_template_directory_uri().'/images/placeholder.png" />';
- }
- }
- add_action('wp_head', 'tnc_share_image_fix');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement