New Landing How can we help? Themeforest Theme Support Joyn Blog Author link to Archive?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Joyn
  • #137640
    tryanmac
    Member
    Post count: 8

    Hi guys

    I’m hoping to find a way to make the Author box at the bottom of posts contain a link to that author’s posts archive. Preferably by making their avatar clickable.

    Any pointers would be hugely appreciated ๐Ÿ™‚

    Tommy

    #137657
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please enable Show author info through Post meta settings at post edit screen. Now you will get desire thing.

    You have to do one more thing. Just open to edit functions.php of your child theme and insert this php code:-

    <?php
    function sf_post_info() {
                global $post, $sf_options;
                $author_info = sf_get_post_meta( $post->ID, 'sf_author_info', true );
    			$post_date       = get_the_date();
    			$remove_dates     = $sf_options['remove_dates'];
    
                if ( is_singular( 'directory' ) ) {
                    $author_info = true;
                }
    
                $post_categories = get_the_category_list( ', ' );
                ?>
    
                <?php if ( $author_info ) { ?>
                    <div class="author-info-wrap clearfix">
                        <div class="author-avatar"><?php if ( function_exists( 'get_avatar' ) ) { ?>
                               <a href="<?php echo site_url().'/author/'.get_the_author_meta( 'nice_name' );?>" ><?php echo get_avatar( get_the_author_meta( 'ID' ), '140' );?></a>
                         <?php   } ?></div>
                        <div class="author-bio">
                            <div class="author-name" itemprop="author" itemscope itemtype="http://schema.org/Person"><h3
                                    class="vcard author"><span itemprop="name"
                                                               class="fn"><?php the_author_meta( 'display_name' ); ?></span>
                                </h3></div>
                            <div class="author-bio-text">
                                <?php the_author_meta( 'description' ); ?>
                            </div>
                        </div>
                    </div>
                <?php } ?>
    
                <?php if ( $author_info ) { ?>
                    <div class="post-info clearfix">
                <?php } else { ?>
                    <div class="post-info post-info-fw clearfix">
                <?php } ?>
               	
               	<?php if ( !$remove_dates ) { ?>
               		<div class="post-date"><?php echo $post_date; ?></div>
               	<?php } ?>
                
                <?php if ( $post_categories ) { ?>
                    <div class="categories-wrap"><?php _e( "Categories:", "swiftframework" ); ?><span
                            class="categories"><?php echo $post_categories; ?></span>
                     </div>
                <?php } ?>
                <?php if ( has_tag() ) { ?>
                    <div class="tags-wrap"><?php _e( "Tags:", "swiftframework" ); ?><span
                            class="tags"><?php the_tags( '' ); ?></span></div>
                <?php } ?>
                <div class="comments-likes">
                    <?php if ( comments_open() ) { ?>
                        <div class="comments-wrapper"><a href="#comments" class="smooth-scroll-link"><i class="ss-chat"></i><span><?php comments_number( __( '0 Comments', 'swiftframework' ), __( '1 Comment', 'swiftframework' ), __( '% Comments', 'swiftframework' ) ); ?></span></a>
                        </div>
                    <?php } ?>
                    <?php if ( function_exists( 'lip_love_it_link' ) ) {
                        lip_love_it_link( get_the_ID(), true, 'text' );
                    } ?>
                </div>
                </div>
    
            <?php
            }?>
    

    Thanks
    Mohammad

    #137679
    tryanmac
    Member
    Post count: 8

    Hi Mohammad

    That almost worked ๐Ÿ™‚

    It makes the avatar redirect to:
    “site”/author (which shows a 404)
    instead of
    “site”/author/”username”

    I’m trying to understand the php code to see if there is a problem but I am a noob and really don’t understand.

    Thanks for your help!!

    #137684
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please find this code:-

    get_the_author_meta( 'nice_name' );
    
    Change to :-
    get_the_author_meta( 'user_nicename' );

    Thanks
    Mohammad

    #137685
    tryanmac
    Member
    Post count: 8

    Thank you – Works perfectly.

    Cheers
    Thomas

    #137686
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome.
    Thanks
    Mohammad

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register