Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (31 sloc) 1.65 KB
//Adding the Open Graph in the Language Attributes
function add_opengraph_doctype( $output ) {
return $output . ' xmlns:og="" xmlns:fb=""';
add_filter('language_attributes', 'add_opengraph_doctype');
//Lets add Open Graph Meta Info
function insert_fb_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
echo '<meta property="fb:admins" content="10156612698306289"/>';
echo '<meta property="fb:app_id" content="1686811138084186"/>';
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="article"/>';
echo '<meta property="og:url" content="' . get_permalink() . '"/>';
echo '<meta property="og:site_name" content="Lemacks Media"/>';
echo '<meta property="og:image:alt" content="Lemacks Media"/>';
echo '<meta property="og:description" content="Lemacks Media makes Web Development Transparent, Affordable, and Reliable.
Find out why so many business owners chose Lemacks Media to be their Web Developer."/>';
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image=""; //replace this with a default image on your server or an image in your media library
echo '<meta property="og:image" content="' . $default_image . '"/>';
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
echo "
add_action( 'wp_head', 'insert_fb_in_head', 5 );