WordPress.org

Forums

request help with Gravatar Positioning - left of post title (5 posts)

  1. cliaz
    Member
    Posted 6 years ago #

    Hi, I'm trying to get Gravatars showing to the left of each post title, like

    In that link (picture), the 26 Apr is where I would like my gravatars to show up, with the post title to the mid-right of it, and the post info bottom-right of it.

    This is the php section from the theme I'm using (WordPress Default) which affects the posts and so on, and as you can see from I've managed to get them to show, just not in the correct position.

    <?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php echo get_avatar( get_the_author_email(), '80' ); ?>
    
    <small><?php the_time('F jS, Y') ?> by <?php the_author() ?> at <?php the_time() ?></small>

    Can post CSS if needed also, but I'm not sure if it's even needed.

    cheers,
    - Klaus

  2. cliaz
    Member
    Posted 6 years ago #

    *bump* :(

  3. Terry
    Member
    Posted 6 years ago #

    For starters, you might want to try assigning the following paramaters to the class .avatar (by default WordPress gives img tags of avatars with a class called 'avatar'.

    img.avatar {
    padding: 4px;
    margin: 0 7px 2px 0;
    display: inline;
    }

    And to prevent the avatar from eating into the entry, clear the float for the 'entry' div:
    div.entry {
    clear: both;
    }

    See if it works :)

  4. cliaz
    Member
    Posted 6 years ago #

    I put in the avatar definition, that worked fine

    Put in the div.entry stuff but I haven't seen any tanglible results...I have no idea what that really does, so I may be trying to use it incorrectly

    I managed to get the gravatars appearing on the same level as the Title, but on the right hand side using

    <div class="post" id="post-<?php the_ID(); ?>">
    				<h2><div class="gravatar"><?php echo get_avatar( get_the_author_email(), '60' ); ?></div>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    so that it looks like this, but I'm trying to get it to look like this

    very much like posts are done in this thread actually, with
    ******** > Name
    Gravatar > user type
    ******** > post date

    cheers for your help so far :)

  5. cliaz
    Member
    Posted 6 years ago #

    browsing the source of this page gave me some rather simpler implementations of how to do this.

    this is the code I ended up using in the Main Template

    <?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    <p><div class="gravatar"><?php echo get_avatar( get_the_author_email(), '60' ); ?></div>
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <small><?php the_author() ?><br />
    <?php the_time('F jS, Y') ?> at <?php the_time() ?></small>
    </p>

    which leads to this

Topic Closed

This topic has been closed to new replies.

About this Topic