$author = $wp_query->post->post_author;
$author = get_user_by('id', $author);
author->user_nicename;
That should get you the author slug which you can use in your conditional statement. get_the_author can only be used inside the loop.
Related Posts:
- How to check if a user (not current user) is logged in?
- Woocommerce: assign an “author” to a product
- Programatically change post author
- Author page: Comments and Ratings?
- Give Author users the right to embed
- How can I publish a post with two or more authors?
- Add rewrite endpoint to author page + pagination
- What’s a good way to put authors into groups
- What is the difference between user_description and description?
- How we can get the author ID by its Name
- How to hide posts count and posts of other users from edit.php for contributors and authors
- How to get posts without author?
- Creating distinct pages for author profiles and lists of posts by author
- Allow Content Author to Publish, But Not Edit or Delete
- Get only the author profile picture image url inside a loop
- Author profile visitors in last 7 days in front end without plugins
- How To Remove The Author(s) From Certain Posts
- Is it possible to set/override default the_author_posts_link to login name?
- Remove /author/ from the author profile url
- Google Authorship on a multi-author blog?
- Display Author role in archive or author page
- How to Add Author Editing Capability to Existing Post by Admin
- get the username of a user in his author page
- Author list ‘special’ author first then ‘normal’ author
- hide something in single page if current author has only one post
- get_the_author_meta( $field, 0 ) returns the administrator $field
- WP authors page
- Send transactional email: first user’s post
- Show woocommerce products in author archive
- How to link to the current User/Author Profile page?
- Author website URL
- How to update author display name on blog posts based on user role
- How can I get the author description’s excerpt?
- How to use Buddypress xProfile field as WordPress Bio
- If post author ID is..show that
- What do you put in child themes author tag?
- Make user as Default contributor for all Blog Posts
- Getting $curauth->ID to work inside a shortcode
- How to list the authors of all revisions?
- Link Author’s Website in Author Bio
- Remove admin role from the “Author” user listing on individual post screen
- Post list based on the page author
- How to set post author to custom post field via front-end form?
- Show Author information on post page on dashboard
- Author List page: Exclude based on last post date not working correctly
- Display emails of users who already posted at least once
- Get author’s first name
- Display only author posts in dashboard all posts panel
- Get avatar of the logged-in user in WordPress
- Breadcrumbs – get the author?
- Display author name, outside the loop, if they haven’t published a custom post
- Author list based on recently active
- Authors & profiles (and exclude ID’s)
- Is author.php a core file?
- Allow Google crawler to crawl specific Author pages
- Clean links in: the_author_meta(‘description’)
- Author name is not working on category page
- Add Date and Author to Posts
- How do I create WordPress Authors Dropdown with links
- How to restrict an author scheduling their post date to a maximum X days ahead from the current date
- Display A list of Admins
- Different posttypes for different authors
- Remove author bio from posts of a specific author
- Create an Author Page on Registration
- Author’s Id from wp list authors function
- author_link filter not work correctly
- Disable WordPress Comment Author Name
- Author Box Meta Issues
- Condition within single.php to send an email to the post author
- Unpublish Authors With not Fulfilled Fields
- Display Recent Posts in BuddyPress Profile
- Display All Authors only
- How to conditionally output to sidebar of each author’s archive and posts by each author?
- ACF Relationship – Exclude pages not created by author
- Display Authors avatars when more than one author
- How to reorder the content of the single post?
- set post author depending on condition via frontend post submit
- How to show author page link
- Can’t change author to myself after post published
- Author page points to 404 error page
- If statement for is_author of a post
- WordPress Authors not showing with User Submitted Posts plugin
- Improving Co-Authors Plus Plugin [closed]
- Show Published and Draft posts from Logged in Author
- WHen I click on post author (on frontend) it doesn’t go to author page
- List of all authors avatars
- How to fix a specific page (author archive) loading speed?
- Show text only to the author of the article
- Display Random Post in Author Page
- Show author image at home page latestest posts plugin
- Open the_author_link() in a new window
- WordPress author box
- How do you display a comment into a mail?
- Show author name not the author ID
- Author page link in comments is different than in posts?
- Author Link Not Displaying
- Change Post and CPT author on the fly while publish the post
- Profile Field In Admin Bar
- Show the most recent post for an author on the author page
- How to force the Author Dropdown to display in Quick/Bulk edit?