• lattesandstories

    (@lattesandstories)


    Hello there!

    So I’m a total amateur when it comes to coding and CSS, but I wanted to add the Author name and Gravatar image to my multi-author blog’s bylines. Thanks to tutorials online and threads in this forum, I was successfully able to do so! Well, almost.

    I added this code to my child theme’s contents.php file to add the author name and the gravatar image:

    <div class="entry-meta">
    		<div id="author_pic">
    		<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author">
    		<?php echo get_avatar( get_the_author_meta('ID'), 60); ?></a>
    		</div>
            <span class="author"><?php the_author_posts_link(); ?></span>
        		<?php sela_entry_meta(); ?>
    		</div><!-- .entry-meta -->

    And to style the gravatars, I added this code to my styles.css:

    .avatar {      
    background-color: #F5F5F5;      
    border: 1px solid #DDDDDD;      
    border-radius: 50% 50% 50% 50%;      
    padding: 4px; 
    } 
    #author_pic {
    float: right;
    margin-right: 0px;
    }

    This seemed to work perfectly! Except: two of my authors’ bylines have their names positioned before, above, and to the left of their gravatar image =/ The other three authors on the site shows the bylines perfectly, with the gravatar image above the author name and both justified to the right. Could someone please help me in fixing the other two author bylines?

    You can view the blog here: L&SP Blog

    Much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Siobhan

    (@siobhyb)

    Hi @lattesandstories,

    I’m currently being redirected to a login page when attempting to view your posts. Would you be able to approve my recent registration request so that I can view posts on your site and help out with this?

    Thread Starter lattesandstories

    (@lattesandstories)

    Hello!

    I didn’t see your registration, so I made the site open for right now. Please let me know if you’re able to access the page now. Thank you!

    Siobhan

    (@siobhyb)

    Perfect, thank you! Can you try the following CSS and let me know if this styles the meta information in a way that you like?

    @media screen and (min-width: 1180px) {
        #author_pic, .entry-meta span {
            float: left;
            text-align: right;
            width: 100%;
        }
    }

    Thanks!

    Thread Starter lattesandstories

    (@lattesandstories)

    Thank you so much, yes this fixed the problem perfectly! ^_^

    Would you mind explaining a briefly what the problem was and how that bit of css fixed it please? I’d like to understand the “theory”/concept behind it just in case I run into something similar in the future.

    Thanks again Siobhan!

    Siobhan

    (@siobhyb)

    @lattesandstories: I can’t remember specifically (and see you’ve set your site to private again) but I believe the issue was related to how your elements were floated. These guides give some good information on floating:

    Hope that’s helpful!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author Name Showing Above Author Image (Custom Bylines)’ is closed to new replies.