Site logo

Archived topic

author box

3 replies · Started by Shivam on June 29, 2019

Viewing posts 1–4 of 4

Hi there,

How are you adding the author box? It looks like you need to wrap the avatar and description in one <div> element. If you can share your code here, I can help you tweak it.

<div class="author-box">
	<?php 
	
	global $post;
	
	$author_id = $post->post_author;
	
	?>
	
	<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?></div>
 
        <h5 class="author-title"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></h5>
	
				<div class="author-summary">
	
        <p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
 
        </div>
 
    </div>

Try changing it to this:

<div class="author-box">
    <div class="avatar">
        <?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
    </div>
 
    <div class="author-info">
        <h5 class="author-title"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></h5>
        <div class="author-summary">
            <p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
        </div>
 
    </div>
</div>

Then change your CSS to this:

.author-box {
    padding: 4%;
    margin-top: 60px;
    font-size: 1em;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
This archived topic is closed to new replies.