Co-Authors Plus
[resolved] Displaying meta data from user profile page (3 posts)

  1. slurve
    Posted 3 years ago #

    Anyone know how I would go about displaying meta data (like a Twitter name) after each author name? The meta data is already set up. Expected output would be:

    By Author1 (@twitter1) and Author2 (@twitter2)

    Would I be able to do this with the coauthors_posts_links() function? I see parameters for before and after, but it seems to be before and after the entire output, not before/after each author.

    Any help would be appreciated. Thanks!


  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 3 years ago #

    Have you tried writing a loop and generating your own byline output?

    Alternatively, you should be able to filter 'coauthors_posts_link' to add the Twitter username. Here's some untested pseudo-code:

    add_filter( 'coauthors_posts_link', 'capx_filter_coauthors_posts_link', 10, 2 );
    function capx_filter_coauthors_posts_link( $args, $author ) {
    	$twitter = get_user_meta( $author->ID, 'twitter', true );
    	if ( $twitter )
    		$args['text'] .= '@' . $twitter;
    	return $args;
  3. slurve
    Posted 3 years ago #

    This worked like a champ. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic