Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #346346

    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!

    #346721

    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

    #389844

    Sorry for the delay, but this worked perfectly. Thank you for the help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Displaying author via custom field instead of WordPress' author system’ is closed to new replies.