customizing text conditional on author for post, before the_author_posts_link
-
I want to customize the text before the author name at the top of the post, conditional on which author.
I am using a customized child theme and am familiar with basic php editing.
The file I am editing is content.single.php. I have made edits to include text changes (currently putting the author name in parenthesis), but cannot find how to change that display conditional on the author, despite searching high and low!What I want to do is to display for author Ann “via Ann” but for all other authors to display “by [author]”. This is for all content, not just one post or one category.
The full php code for the meta at the top of the post is below, and obviously the section I want to make conditional is the last part calling up the_author_posts_link (in bold).
Grateful for any help! Thanks ??
<?php // date echo '<p><i aria-hidden="true"></i>'; the_time(get_option('date_format')); echo '</p>'; // comments echo '<p><i aria-hidden="true"></i>'; /* translators: %s: post title */ comments_popup_link( sprintf( __( 'Thoughts or questions?<span class="screen-reader-text"> on %s</span>', 'gillian' ), get_the_title() ) ); echo '</p>'; <strong>echo '<p>'; _e( '(', 'gillian' ); the_author_posts_link(); echo ')</p>';</strong> ?>
The page I need help with: [log in to see the link]
- The topic ‘customizing text conditional on author for post, before the_author_posts_link’ is closed to new replies.