how to share in facebook twitter

Posted: June 24, 2015 in Uncategorized

please add tag inside “head” tag

LINK

function  add_meta_function(){
$res_soc = ”;
if(is_single()){
global $post;
$res_soc = ‘<meta property=”og:url” content=”‘.get_the_permalink($post->ID).'” />’;
$res_soc .='<meta property=”og:title” content=”‘.get_the_title($post->ID).'” />’;

$res_soc .='<meta property=”og:description” content=”‘.substr(strip_tags(strip_shortcodes($post->post_content)),0,100).'” />’;
if(has_post_thumbnail($post->ID)){
$social_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
$res_soc .='<meta property=”og:image” content=”‘.$social_url.'” />’;
}else{
$res_soc .='<meta property=”og:image” content=”” />’;
}

}
echo $res_soc;
}

social

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s