Skip to content

Instantly share code, notes, and snippets.

@derweili
Created March 1, 2016 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derweili/661c92259929e16664e9 to your computer and use it in GitHub Desktop.
Save derweili/661c92259929e16664e9 to your computer and use it in GitHub Desktop.
Code to add the author to the meta function of the sela wordpress theme. Answer for forum topic on wordpress.org https://wordpress.org/support/topic/meta_data-add-author-in-frontend?replies=1
if ( ! function_exists( 'sela_entry_meta' ) ) :
function sela_entry_meta() {
// Sticky
if ( is_sticky() && is_home() && ! is_paged() ) {
echo '<span class="featured-post">' . __( 'Featured', 'sela' ) . '</span>';
}
echo '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) . '">' . get_the_author() . '</a>';
// Date
if ( ! is_sticky() ) {
sela_entry_date();
}
// Comments
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link( __( 'Leave a comment', 'sela' ), __( '1 Comment', 'sela' ), __( '% Comments', 'sela' ) );
echo '</span>';
}
// Edit link
edit_post_link( __( 'Edit', 'sela' ), '<span class="edit-link">', '</span>' );
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment