Skip to content

Instantly share code, notes, and snippets.

@mwordpress
Last active February 9, 2017 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwordpress/b22b657ec25f88154d3a6ebb14a382ff to your computer and use it in GitHub Desktop.
Save mwordpress/b22b657ec25f88154d3a6ebb14a382ff to your computer and use it in GitHub Desktop.
<link rel="image_src" href="رابط الصورة" />
<meta property="og:image" content="رابط الصورة" />
<?php
if (is_single()) :
if (has_post_thumbnail()) :
$img = wp_get_attachment_image_src( get_post_thumbnail_id($postid), "full" );
$url = $img['0'];
echo '<link rel="image_src" href="'.$url.'" />';
echo '<meta property="og:image" content="'.$url.'" />';
endif;
endif;
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment