buddypress author link code example

Example: buddypress author link

// Change Post's Author URL to Buddypress Profile URL
add_filter('generate_post_author_output','generate_post_author_output_buddyprss_url');

function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
$post_author_profile_link = sprintf( ' <span class="byline">%1$s</span>',
			sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
				__( 'by','generatepress'),
				esc_url( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ),
				esc_attr( sprintf( __( 'Know more about %s', 'generatepress' ), get_the_author() ) ),
				esc_html( get_the_author() )
			)
		) ;
return  $post_author_profile_link;

}

Tags:

Misc Example