Hello,
I would like the post author to display under the date in my posts. E.g. http://humphreys.law/library/welcome/. I have the post meta enabled but the author name does not appear.
Kind regards,
Alex
Hello,
I would like the post author to display under the date in my posts. E.g. http://humphreys.law/library/welcome/. I have the post meta enabled but the author name does not appear.
Kind regards,
Alex
Hey Alex,
Thanks for writing in! To display the post author under the date in your post meta, since the child theme is set up, please add the following code in your child theme’s functions.php file
// Custom Entry Meta
// =============================================================================
if ( ! function_exists( 'x_icon_entry_meta' ) ) :
function x_icon_entry_meta() {
$date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
//
// Author.
//
$author = sprintf( '<br/><span>%s</span>',
get_the_author()
);
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s</p>',
$date,
$author
);
}
}
endif;
We would loved to know if this has work for you. Thank you.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.