Skip to content

Instantly share code, notes, and snippets.

@iraycd
Created November 15, 2014 18:08
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 iraycd/67c59236d2adb05afe21 to your computer and use it in GitHub Desktop.
Save iraycd/67c59236d2adb05afe21 to your computer and use it in GitHub Desktop.
Update Header Woocommerce Open Graph
<?php if ( is_home() ) { // If on the homepage ?>
<!--/ Open Graph for Homepage /-->
<meta property="og:title" content="<?php echo get_bloginfo(strip_tags('name')) ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo home_url() ?>" />
<meta property="og:description" content="<?php echo get_bloginfo (strip_tags('description')) ?>" />
<meta property="og:site_name" content="<?php echo get_bloginfo(strip_tags('name')) ?>" />
<meta property="og:image" content="http://unglove.me/path-to-thumbnail-image.jpg" />
<?php } ?>
<?php if ( is_woocommerce() ) { // If on a woocommerce page ?>
<!--/ Open Graph for Woo Product /-->
<meta property="og:title" content="<?php echo get_the_title() ?>" />
<meta property="og:type" content="product" />
<meta property="og:url" content="<?php echo get_permalink() ?>" />
<meta property="og:description" content="<?php echo get_the_excerpt() ?>" />
<meta property="og:site_name" content="<?php echo get_bloginfo(strip_tags('name')) ?>" />
<meta property="og:image" content="<?php $featuredimg = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full"); echo $featuredimg[0]; ?>" />
" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment