Advertisement
Guest User

Untitled

a guest
May 12th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. if ( ! function_exists( 'jas_claue_social_meta' ) ) {
  2. function jas_claue_social_meta() {
  3. $image_src_array = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full', true );
  4. $output = '<meta property="og:site_name" content="' . get_bloginfo( 'name') . '"/>'. "\n";
  5. $output .= '<meta property="og:image" content="' . $image_src_array[ 0 ] . '"/>'. "\n";
  6. $output .= '<meta property="og:image:url" content="' . $image_src_array[ 0 ] . '"/>'. "\n";
  7. $output .= '<meta property="og:url" content="' . esc_url( get_permalink() ) . '"/>'. "\n";
  8. $output .= '<meta property="og:title" content="' . esc_attr( strip_tags( get_the_title() ) ) . '"/>'. "\n";
  9. $output .= '<meta property="og:description" content="' . esc_attr( strip_tags( get_the_excerpt() ) ) . '"/>'. "\n";
  10. if ( function_exists( 'is_product' ) && is_product() ) {
  11. $output .= '<meta property="og:type" content="product"/>'. "\n";
  12. } else {
  13. $output .= '<meta property="og:type" content="article"/>'. "\n";
  14. }
  15.  
  16. echo balanceTags( $output );
  17. }
  18. add_action( 'wp_head', 'jas_claue_social_meta' );
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement