Tagged: author, custom field
Hello,
I’m using Enfold with a child theme. I’m currently collecting the names of post authors via a custom field instead of using WordPress’ native author system. How do I display the custom field’s contents instead of the current setting, which displays the WordPress author?
Thanks in advance for any help!
Hey sasusc!
Try adding this to the bottom of your /enfold/functions.php file,
add_filter( 'the_author_posts_link', 'customization_change_author' );
function customization_change_author( $link ) {
global $post;
$author = get_post_meta( $post->ID, 'custom_author', true );
if ( $author != null ) { return $author; } else { return $link; }
}
And change “custom_author” to whatever key your custom field is set to.
Best regards,
Elliott
Sorry for the delay, but this worked perfectly. Thank you for the help!