M Ureeb
asked 5 years ago

i want to link the author’s name on the left hand side of the single post in the old version of dw focus.

3 Answers
DominicStaff
answered 5 years ago

Hi,
Please let me know which version you are using the theme.
Regards,

M Ureeb
answered 5 years ago

i am using the same version as this person: enter link description here

  1. i want the authors name (linked to author’s posts) and avatar to be on the top left side of the post, and then the sharing options. I also want the divider between these two (author info and sharing options) as i am not getting a divider currently. Image of my site is below:

![enter image description here](http://i.imgur.com/EsgJVeN.png "enter image title here")

  1. The divider was there before i removed the tag options.
DominicStaff
answered 5 years ago

The DW Focus default was support to link to author posts, you can open the functions.php file then find the line code (about line 412 to line 480)
This code that I have used in the functions.php file:
Our file: functions.php: http://snippi.com/s/mc3ubjd

if( ! function_exists('dw_focus_post_actions') ) {
    /**
     * Display Social Share, Print, Sent Button
     */
    function dw_focus_post_actions() { 
        $post_id = get_the_ID(); 
        $url = rawurlencode( get_permalink() );
        $title = urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8'));
        $twitter_count = dw_get_twitter_count( get_permalink() );
        $facebook_count = dw_get_facebook_count( $url );
        $linkedin_count = dw_get_linkedin_count( get_permalink() );
        $gplus_count = dw_get_plusones_share_count( get_permalink() );

    ?>

        <div class="entry-action">
        <span class="title-action"><?php _e('Authors','dw_focus') ?></span>
            <div class="author-info">
            <?php echo get_avatar( get_the_author_meta( 'ID' ), 44 ); ?>
                <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 -->
            <div class="social-action" data-nonce="<?php echo wp_create_nonce( '_dw_sharing_count_nonce' ) ?>">

                <span class="title-action"><?php _e('Sharing','dw_focus') ?></span>
                <ul>
                    <li id="twitter-share" class="twitter" data-post-id="<?php echo $post_id ?>" data-nonce="<?php echo wp_create_nonce( '_dw_focus_single_tweet_count_nonce' ); ?>"><i class="icon-twitter"></i><a href="https://twitter.com/intent/tweet?url=<?php echo $url; ?>&amp;text=<?php echo $title; ?>"><?php _e('Twitter','dw_focus') ?></a><span class="digit digit-twitter"><?php echo $twitter_count; ?></span></li>
                    <li class="facebook"><i class="icon-facebook-sign"></i><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&amp;t=<?php echo $title; ?>" ><?php _e('Facebook','dw_focus') ?></a><span class="digit digit-facebook"><?php echo $facebook_count ?></span></li>
                    <li class="google"><i class="icon-google-plus-sign"></i><a href="https://plus.google.com/share?url=<?php echo $url; ?>" ><?php _e('Google +','dw_focus') ?></a><span><?php echo $gplus_count; ?></span></li>
                    <li class="linkedin"><i class="icon-linkedin-sign"></i><a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo $url ?>&amp;title=<?php echo $title ?>&amp;summary=<?php echo rawurlencode( get_the_excerpt() ); ?>"><?php _e('Linkedin','dw_focus') ?></a><span class="digit digit-linkedin"><?php echo $linkedin_count ?></span></li>
                    <li class="email"><i class="icon-envelope-alt"></i><a href="mailto:?Subject=<?php echo $title; ?>&amp;body=<?php echo $url; ?>"><?php _e('Email this article', 'dw_focus' ); ?></a></li>
                    <?php if( ! is_handheld() ) { ?>
                    <li class="print"><i class="icon-print"></i><a href="#" onclick="window.print();"><?php _e('Print this article','dw_focus'); ?></a></li>
                    <?php } ?>
                </ul>
            </div>

            <?php if ( is_single() ): ?>
                <div class="co-author">

                <?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(44,44) ); ?>
                            <?php else : ?>
                                <?php echo get_avatar( $coauthor->ID, 44); ?>
                            <?php endif; ?>
                            <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><!-- .author-info -->
                    <?php endforeach; ?>

                <?php else : ?>

After changing/adding code you can add the following code to the style.css file to change color and add border bottom for the Author section.

.single .site-content>.hentry .entry-action .author-info a:hover {
  color: #000;
}
.single .site-content>.hentry .entry-action .author-info {
  border-bottom: 1px solid #ddd;
  padding-bottom: 20px;
}

Hope this help !

Powered by DW Question & Answer Pro