Support » Plugin: Co-Authors Plus » [Plugin: Co-Authors Plus] Co Authors First and Last names

  • Resolved lowestofthekeys

    (@lowestofthekeys)


    Hi all.

    First off, Daniel this is wonderful plugin, bu tI think I’m missing a function for what I want it to do.

    I am attempting to list out the co authors at the beginning of the article after “By:”

    I used<?php if ( function_exists( 'coauthors' ) ) { coauthors(); } else { the_author(); } ?>

    But unfortunately it refers to their usernames instead of the first and last names.

    Is there a snippet that will allow me to list two authors by first and last name? For examples, I want it to look likes this: “By: Joe Smith and Alex Vasquez.”

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Argh ignore this.

    I checked my functions.php and realized there was some old code in there taking out the “display name as” option under “edit users.”

    *removes foot from mouth*

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hand Built

    Cool, that’s what I was going to suggest 🙂 Glad you figured it it out

    Dear Daniel, thanks a lot of all for this great plugin! I’m using it on a blog with more than 70 authors and it helps me a lot.

    Like Jon I wanted to change the displayed name to first and last name. Manually changing the “display name as” option for every user, however, was not an option and I don’t really trust the plugins that purport to do so.

    My suggestion thus would be to add a function coauthors_fullnames. I don’t know enough about coding to do this, so I had to come up with a little workaround.

    I changed the function coauthors_lastname so that it returns an empty value:

    function coauthors_lastnames($between = null, $betweenLast = null, $before = null, $after = null, $echo = true ) {
    	return coauthors__echo('get_the_author_meta', 'tag', array(
    		'between' => $between,
    		'betweenLast' => $betweenLast,
    		'before' => $before,
    		'after' => $after
    	), '', $echo);
    }

    This then triggers your fallback function, which I modified as follows:

    // Fallback to user_login if we get something empty
    		if( empty( $author_text ) )
    			$author_text1 = $i->current_author->user_firstname;
    			$author_text2 = $i->current_author->user_lastname;
    			$author_text = "$author_text1 $author_text2";

    I know this is far from elegant, but it works!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Co-Authors Plus] Co Authors First and Last names’ is closed to new replies.