Test whether on a single post. If so, get a user object by the current posts’ author ID and echo its display_name
property:
if ( is_single() ) {
global $post;
$author = get_userdata( $post->post_author );
echo $author->display_name;
}
Related Posts:
- Sidebar random author spotlight
- Get list of all registered sidebars
- What is the difference with get_sidebar and dynamic_sidebar?
- how do I get_sidebar into a varaible?
- Best way of making multiple sidebars
- Changing name of sidebar widget
- Getting post-thumbnails from another WP site
- How to add author details in the post sidebar?
- Get custom side bar on custom post archive page
- bloginfo(‘stylesheet_directory’) vs. get_stylesheet_directory_uri() and include(‘file.php’) vs. get_template_part()
- How do I hook a sidebar via add_action?
- Category specific months list in sidebar.php
- Get a sidebar at the top of the page
- Custom sidebar not showing in the dashboard
- Sidebar Generator? :)
- Main Sidebar Dispappeared – What could possibly cause this?
- Change which sidebar get_sidebar() gets from functions.php
- Why and how is twentythirteen adding a margin-top to my footer?
- Adding content to sidebars
- Load same sidebar multiple times
- change sidebar or just widgets for 2 specific post type single posts
- Unregister sidebar from Child-Theme
- How can I hide the sidebar on specific pages?
- How can you add a link to a sidebar description?
- Same date is repeating on my custom ‘Most Recent Posts’ on sidebar
- How to add Sidebar and Full width option in post editor
- Corrupt WordPress Design/Appearance [duplicate]
- how to exclude posts on current page from recent posts sidebar widget
- Output dynamic_sidebar into PHP
- Creating a different side bar for single posts than for main page.
- WP for main site and two blogs – implementation
- How to list custom post types in a secondary sidebar?
- From what hook on is it possible to conditionally add actions?
- Dividing widgets in sidebar?
- Post thumbnails in sidebar & footer?
- Paging in a sidebar mini loop
- Include a sidebar on the static front page of twenty thirteen
- How to get the sidebar HTML content?
- How to increase maximum number of sidebars support?
- if statement in sidebar.php checking page id or template or title
- Unable to call specific dynamic_sidebar
- Display smilies in Sidebar, too?
- How to enable the default sidebar area?
- Remove Sidebar from WordPress [closed]
- How to send data to sidebar?
- Gutenberg sidebar example does not update meta field in the database
- Implementing Sticky Kit on WordPress
- Check if sidebar is rendered?
- Not Getting Sidebar
- Where is dynamic_sidebar content defined?
- Why does my sidebar get dragged down on this specific uid?
- Dynamic Sidebar Conditional [duplicate]
- finding sidebar content in wordpress
- Extra copy of sidebar appears in footer
- Create an array of “read next” posts using a dynamic offset
- Can Sidebar’s widget retrieve information from content area?
- Twenty Thirteen get_sidebar Question
- register_sidebar_widget is deprecated since version 2.8
- get dynamic_sidebar() value in array in wordpress
- Sidebar not showing up on homepage
- display specific sidebar for each role
- Change twentytwelve sidebar responsive relocation?
- Split the content of the_content();
- How to troubleshoot Sidebar not being generated
- How to remove the ‘Archives’ title and list and the ‘Meta’ title
- Can the Twenty Eleven theme have a Main Sidbar at all?
- Select a Sidebar from Page Creation
- Why is my custom sidebar always open on the widgets screen in Admin?
- Header image is overlapping sidebar?
- Content not showing up when using custom template + sidebar
- How to assign a sidebar to a WordPress page when none was there before
- How do I set is_active_sidebar?
- Customizer doesn’t recognise sidebar
- How do I edit the side-bar (doesn’t seem to be a menu)?
- sidebar / widget wont show
- Sidebar widgets are looping out of the sidebar wrapper
- A way to have some per sidebars settings integrated with the native sidebar/widgets UX?
- Children Pages Displaying Only Intermittenty
- Extra sidebar in Twenty fifteen
- sidebar not displaying when using get data
- Why isn’t my registered sidebar showing up in the admin?
- More than one dynamic sidebar
- Can’t find link to add content to pages
- How to add banners in sidebar of my theme [duplicate]
- Sidebar does not display on blog page, but fine with static pages
- My side bar is missing from new pages.
- Archives and category of authors
- Template is different with and without comments
- Placing video content into a sidebar
- different contents and same sidebar approach?
- How do I store get_sidebar in a varaible? [duplicate]
- How to create another sidebar to be shown on another page?
- Images in Woocommerce Product Sidebar [closed]
- How do I load my site without the side bars? This is for an app
- ReadWriteWeb-like sidebar scrolling
- How do I move the sidebar more to the right in TwentySeventeen?
- Remove Sidebar for Pages on Canvas Wootheme [closed]
- How can I add custom sidebar to my theme? [closed]
- how do I change the side bar content?
- How to hide sub categories in sidebar [closed]