Skip to content

Instantly share code, notes, and snippets.

@nameDark
Last active September 13, 2016 10:30
Show Gist options
  • Save nameDark/ebe64b7c0a2212de65d17f3837409885 to your computer and use it in GitHub Desktop.
Save nameDark/ebe64b7c0a2212de65d17f3837409885 to your computer and use it in GitHub Desktop.
og example
//og example
<?php if (is_singular( )) { ?>
<meta property="fb:app_id" content="<?php if( $mytheme['fb_app_id']!='') {
echo "background-color:" . $mytheme['fb_app_id']; } ?>" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="ru_RU" />
<meta property="og:title" content="<?php the_title( ); ?>" />
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" />
<meta property="og:url" content="<?php echo get_current_URL(); ?>"/>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>"/>
<meta property="og:image" content="<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full', true);
echo $thumb_url[0]; ?>"/>
<link rel="image_src" href="<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full', true);
echo $thumb_url[0]; ?>" />
<?php }; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment