Content Views helps you to show author of post easily without coding.
By default, author name with hyperlink to the author page will be shown.
To show author name without link, please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):
- For a single View:
// Content Views Pro - Author name without hyperlink add_filter( 'pt_cv_field_meta_author_html', 'cvp_theme_author_no_link', 100, 2 ); function cvp_theme_author_no_link( $args, $post ) { global $pt_cv_id; if ( $pt_cv_id === 'VIEW_ID' ) { $args = sprintf( '%s', get_the_author_meta( 'display_name', $post->post_author ) ); } return $args; }
(replace VIEW_ID with ID of the View which you want to apply).
- For all Views:
// Content Views Pro - Author name without hyperlink add_filter( 'pt_cv_field_meta_author_html', 'cvp_theme_author_no_link_all', 100, 2 ); function cvp_theme_author_no_link_all( $args, $post ) { $args = sprintf( '%s', get_the_author_meta( 'display_name', $post->post_author ) ); return $args; }
Best regards,