Titta
asked 8 years ago

Hello, in the single post not see the author of the post in the left top area under sharing and tag, while in previous versions of the theme. I can do to see them?

Thanks

2 Answers
DominicStaff
answered 8 years ago

If you want to make the author section under sharing & tags section, you can open the template-tags.php file in the inc folder and find the line 52:

<?php
 $tags_list = get_the_tag_list( '', __( ', ', 'dw-focus' ) );
 if ( $tags_list ) {
 printf( '<div class="tags-links">' . __( '<h3>Tags</h3> %1$s', 'dw-focus' ) . '</div>', $tags_list );
 }
 ?>

And add the following code under the line 52:

<?php if ( is_single() ): ?>
<div class=”co-author”>
<span class=”title-action”><?php _e(‘Authors’,’dw_focus’) ?></span>
<?php if( function_exists( ‘coauthors_posts_links’ ) ) : ?>
<?php $coauthors = get_coauthors(); ?>
<?php foreach( $coauthors as $coauthor ): ?>
<div class=”author-info”>
<?php if( get_the_post_thumbnail( $coauthor->ID ) ) : ?>
<?php echo get_the_post_thumbnail( $coauthor->ID , array(32,32) ); ?>
<?php else : ?>
<div class=”author-avatar”>
<?php echo get_avatar( $coauthor->ID, 32); ?>
</div>
<?php endif; ?>

<div class=”author-description”>
<a class=”author-name” href=”<?php echo esc_url( get_author_posts_url($coauthor->ID,$coauthor->user_nicename) ); ?>” rel=”author”><?php echo $coauthor->display_name ?></a>
</div>
</div><!– .author-info –>
<?php endforeach; ?>
<?php else : ?>
<div class=”author-info”>
<?php echo get_avatar( get_the_author_meta( ‘ID’ ), 32 ); ?>
<a class=”author-name” href=”<?php echo esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ); ?>” rel=”author”><?php echo get_the_author(); ?></a></h2>
</div><!– .author-info –>
<?php endif; ?>
</div>
<?php endif ?>
Then add the following CSS code to the style.css file:

.single .entry-sidebar .co-author .title-action {
 color: #777;
 text-transform: uppercase;
 font-size: 11px;
 font-weight: normal;
 line-height: 20px;
 margin: 0 0 5px;
}
.single #main .post .entry-sidebar .author-info {
 border: none;
 background: none;
 padding: 40px 20px 20px 50px;
 min-height: 60px;
}
.single #main .post .entry-sidebar .author-info .author-avatar {
 left: 0px;
}

 

Titta
replied 8 years ago

Thanks Dominic, but author area is very close (attached) to the tags and lacks the line under “Author” and then not take photo author but the photo default author
I’d like a larger photo and under the author’s name
Can you help me?

DominicStaff
answered 8 years ago

Please send me your site for further checking. I will help you resolve it.

Powered by DW Question & Answer Pro