How to add editor’s name to entry meta byline?

Here’s a small screenshot of what this code produces:

enter image description here

Demo Editor is a new user i added with Editor status and then logged in as Demo Editor and modified a post to test this solution works.

You can create a custom template tag in your child theme like this and add the template tag in your content.php file.

All depends on your theme.

Tested and works on Twenty Fourteen:

Here’s the template tag example you can add to a file named template-tags.php in your child theme:

<?php if ( ! function_exists( 'edited_by' ) ) :

function edited_by() { 

printf( '<span class="byline"><span class="author vcard"><a class="url fn n" href="https://wordpress.stackexchange.com/questions/144044/%4$s" rel="author">%5$s</a></span></span>',
    esc_url( get_permalink() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( 'editor' ) ) ),
    get_the_modified_author()
);
}
endif;

The above code needs some work however it does work on the front end.

The editor author link will need to be fixed and you will need to add the text Edited by:

Below is an example of how it looks in the content.php file i copied over to the child theme.

<div class="entry-meta">
<?php
if ( 'post' == get_post_type() )
twentyfourteen_posted_on();
edited_by(); ?>

I also added this in functions below to include the new file.

// Custom template tags for this theme.
require get_stylesheet_directory() . '/inc/template-tags.php';

Leave a Comment