To display the author’s avatar within The Loop use get_avatar() like that:
<?php print get_avatar(get_the_author_meta('ID'), '30', '', '', ['class' => 'foo-bar']); ?>
To display the author’s display name within The Loop use the_author():
<?php the_author(); ?>
So put everything inside The Loop and then:
<?php
while (have_posts()) : the_post();
?>
<div class="row">
<div>
<h1 class="primary-color">
<?php the_title(); ?>
</h1>
<span class="avatar">
<?php print get_avatar(get_the_author_meta('ID'), '30', '', '', ['class' => 'foo-bar']); ?>
</span>
by <span class="primary-color"><?php the_author(); ?></span>
<span class="pipe">|</span>
<span class="date"><?php echo get_the_date(); ?></span>
</div>
</div>
<div class="row">
<?php the_content(); ?>
</div>
<?php endwhile; ?>
Related Posts:
- the_author_posts_link css class
- How do I get the author’s page url from their ID?
- Current post’s author name in the author meta tag
- Allow authors to post only in categories they create in WordPress
- Get_the_author doesn’t return author name
- the_author() not working outside the loop
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- How Can I Call Up The Author’s Name on a Post
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Retrieving Author ID in wp-admin area
- Storing Array from returned database query and using the array in a new query
- Getting the author name on author archive page
- edit_comment_link is not showing for comment author
- Remove author link wherever author’s name is display
- Noindex Posts From Certain Authors In WordPress
- Noindex subscriber author page
- How to hide the author box of a specific user?
- Comment_author_url doing nothing
- Create condition for Author bio Social Links
- How to change the author box selection on a post to a custom taxonomy
- Remove Author Links
- WordPress redirect to a subpage – how to create a template for subpage?
- Show all people who commented on all posts by an author
- Show sidebar only to author of post
- Posts missing on author page
- Return author name as a tag using get_author
- Send Notification to all users that followed some author
- Following/Followers Users list Using Ajax Pagination inside Author Profile
- Send email to users when they get new followers
- How to make a parent page for author.php?
- Changing WordPress author name in database
- Showing the authors username and bio on custom author.php
- How can I output the slug of a comment author?
- How to have Function of a plugin using global vars into a shortcode?
- When I use rewind_post() it shows menu items in my loop
- Assign new post author IF another user in custom field on post transition
- Create guest author page via php
- WordPress theme options error
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Moving code from theme header to functions.php
- Woocommerce Email attachments not working – file not being attached
- Best way to use a large array in function
- AJAX button action in foreach
- Ajax button not working
- Get categories names as an array to use it in theme settings
- register_setting & add_settings_error validation issues with multiple fields
- WordPress wp-admin redirect and exception
- Use $wpdb or other PHP script method to find/replace in WP database
- Validate and Sanitize WP REST API Request using WP JSON Schema?
- Function Reference/human time diff for future posts
- export a mysql table to csv with column headers
- Override index with a custom PHP page
- How do I correct the code in php? [closed]
- Dynamically adding filters
- Reusable code that I can store in the function.php and apply to other templates as need. Dry Code
- How can I tell which of my pages are single-view pages?
- Menu not styling. New menus functionality giving me a headache
- Get category id when SEO URL is turned on
- Customizer control save then return to default
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- How to sort WooCommerce products page by latest in-stock items first?
- WP_Query for woocommerce products with a pattern as a post_title
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- Get WooCommerce products with similar SKU
- Ajax filter with loadmore button
- Showing search results on a page
- How do I properly upgrade WordPress’s PHP within an OpenLiteSpeed GCP instance? [closed]
- How do I disable cache for a certain page?
- how to fix Warning: A non-numeric value encountered in this specefic line of code
- i got this error : Warning: call_user_func_array() expects exactly 2 parameters, 3 given in
- Fetch commens from a specific post
- Set notification if is two product category in cart
- Another site within WordPress page, disabling 404 error for pages that exist but outside of WP system
- Add parent menu item in sub-menu in custom nav_walker
- Reverse Cross-Sells (WooCommerce)
- Allowing HTML elements in title widgets spacing problem
- Pull a div from one WordPress site into another WordPress site
- Can not manually create a database ( db, user, pass ) for a plugin
- Are widget arguments always set inside My_Widget::widget()?
- Rewrite url for custom post type not working
- Auto create description in post
- Jquery and Sticky
- Different image and background color depending on page type
- How to style this wp_list_pages markup
- Get permalink for a post from inside WordPress and route to a related site
- WordPress format json in postmeta table
- How to list all the posts in a personalized page? WordPress
- get_page_by_title() doesn’t return the post object if the title has inverted comma (‘)
- notify users when changed database
- Check user last login date
- 404 page is not the same when using PHP code in functions
- Why can’t I enter the wordpress admin interface?
- Show div only if product has attribute
- Sorting a custom post type in pre_get_posts
- YouTube embeds Cross-Origin Request Blocked (CORB) error
- How to change post date and post time in WordPress automatically with a function
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- Add up all numbers from a WordPress query [closed]
- WordPress admin area not sending mail (but works with WP Mail SMTP, Test Mail, and PHP mail() function)