Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'jas_claue_social_meta' ) ) {
- function jas_claue_social_meta() {
- $image_src_array = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full', true );
- $output = '<meta property="og:site_name" content="' . get_bloginfo( 'name') . '"/>'. "\n";
- $output .= '<meta property="og:image" content="' . $image_src_array[ 0 ] . '"/>'. "\n";
- $output .= '<meta property="og:image:url" content="' . $image_src_array[ 0 ] . '"/>'. "\n";
- $output .= '<meta property="og:url" content="' . esc_url( get_permalink() ) . '"/>'. "\n";
- $output .= '<meta property="og:title" content="' . esc_attr( strip_tags( get_the_title() ) ) . '"/>'. "\n";
- $output .= '<meta property="og:description" content="' . esc_attr( strip_tags( get_the_excerpt() ) ) . '"/>'. "\n";
- if ( function_exists( 'is_product' ) && is_product() ) {
- $output .= '<meta property="og:type" content="product"/>'. "\n";
- } else {
- $output .= '<meta property="og:type" content="article"/>'. "\n";
- }
- echo balanceTags( $output );
- }
- add_action( 'wp_head', 'jas_claue_social_meta' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement