Created
June 1, 2016 21:03
-
-
Save pcfreak30/cb42eebc8c47f0f7d09889dbbcdb38d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dwqa_the_author( $display_name ) { | |
global $post; | |
if ( empty( $post ) ) { | |
return $display_name; | |
} | |
if ( 'dwqa-answer' == $post->post_type || 'dwqa-question' == $post->post_type) { | |
if ( dwqa_is_anonymous( $post->ID ) ) { | |
$anonymous_name = get_post_meta( $post->ID, '_dwqa_anonymous_name', true ); | |
$display_name = $anonymous_name ? $anonymous_name : __( 'Anonymous', 'dwqa' ); | |
} | |
} | |
return $display_name; | |
} | |
add_filter( 'the_author', 'dwqa_the_author' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment