Custom Facebook author tag wordpress -


i have function in wordpress checks if user of post haves facebook id add specific meta tag facebook id else if empty it's adding preset facebook id. problem if user of post haves facebook id in facebookurl area function adding default facebook id.

function facebook_author_tag() {    if ( is_single() ) {      global $post;      $author = (int) $post->post_author;      $facebook_url = the_author_meta('facebook_url');       if ( !empty( $facebook_url ) )  	 {   	  		echo '<meta property="article:author" content="'. $facebook_url .'" />';  	 } else{  		 	echo '<meta property="article:author" content="https://www.facebook.com/test" />';       }    }  }  add_action( 'wp_head', 'facebook_author_tag', 8 );

and code used insert socials fields in user's page.

function my_new_contactmethods( $contactmethods ) {  // add twitter  $contactmethods['twitter'] = 'twitter';  //add facebook  $contactmethods['facebook'] = 'facebook';         return $contactmethods;  }  add_filter('user_contactmethods','my_new_contactmethods',10,1);

thanks if can me.


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -