WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. slurve
    Member
    Posted 1 year 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!

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year ago #

    This worked like a champ. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic