• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Gravatar Before Post title

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Gravatar Before Post title

This topic is: not resolved

Tagged: gravatar, post title

  • This topic has 8 replies, 2 voices, and was last updated 13 years, 5 months ago by Brad Dalton.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • April 26, 2013 at 9:45 am #37862
    sterman7
    Member

    There are some threads that address this but I am having no luck.  So, to help anyone else out as well as myself. Can some one drop some knowledge how to simply add a gravatar to the before post title?  Please do not point me to the Bill Erickson post it is not particularly helpful for non coders like myself.  I am happy to mess with the functions.php file only if I know exactly what I am doing.  I have enough knowledge just to be dangerous and since the Erickson write up is not really for Genesis I find it not useful.  Any help would be greatly appreciated by me and anyone that follows in the future.

     

     

    http://marketandeconomy.com
    April 26, 2013 at 11:37 am #37882
    Brad Dalton
    Participant

    I've written some code for this which includes the after title hook which you can simply change to the before post title hook.

    Can't get into Github gists at the moment because of internet problems but will post the code as soon as i can.


    Tutorials for StudioPress Themes.

    April 26, 2013 at 11:41 am #37883
    sterman7
    Member

    Thanks for the reply.

    April 26, 2013 at 12:13 pm #37888
    Brad Dalton
    Participant


    Tutorials for StudioPress Themes.

    April 26, 2013 at 12:56 pm #37903
    sterman7
    Member

    Brad,

    Thanks.  Two follow on questions if you do not mind.

    1. If I want the avatars to appear before the post title on the home page would it be as simple as editing your code by adding
    if (is_home() after the if (is_single())???

    2.  Is there any way to get the avatar on the same line as the title versus the line above?  Reference any post on this site - http://readingthecompass.com

    Thanks again!!

     

    April 26, 2013 at 1:07 pm #37904
    sterman7
    Member

    Doin' my leg work man.  If figured out how to nest a second conditional for the answer to my first question but  I am afraid I cannot come up with how to move the image onto the same line as the actual title on both the home and single pages.  ??

    The answer to my first question for future readers is:

    if (is_home() || is_single())

    April 26, 2013 at 1:38 pm #37907
    sterman7
    Member

    Still doin' my leg work and got the images in line with the title by:

    I updates the .post image line of code in my css style sheet to look like this:

    .post-image {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    padding: 4px;
    float:left;
    display: inline;
    margin-right: 0.5em;
    }

    Much love to Brad for doing the heavy lifting.

    April 26, 2013 at 1:50 pm #37909
    sterman7
    Member

    So for anyone that wants to put a gravatar next to their post titles on both their home page and the posts themselves here is what I did thanks to Brad.  Keep in mind I have properly set up my gravatar account to work with wordpress.

    in my functions.php file I added:
    
    
    
    /** * @author Brad Dalton - WP Sites * * @link http://wpsites.net/web-design/display-post-author-avatar-byline/ */ function wpsites_single_post_author_avatars() { if (is_home() || is_single()) { echo get_avatar(get_the_author_id(), 40); } } add_action('genesis_before_post_title', 'wpsites_single_post_author_avatars');
      Then I did the following to my style sheet under the IMAGES headline find the .post-image details and update them:
    .post-image { background-color: #f5f5f5; border: 1px solid #ddd; padding: 4px; float:left; display: inline; margin-right: 0.5em;
     
    April 26, 2013 at 8:28 pm #37990
    Brad Dalton
    Participant

    Good stuff. Just woke up but see you have nailed it with the PHP. Not sure about the CSS but it seems to work for you.

    See you learn't a lot about conditional tags and custom functions which will give you alot of confidence moving forward.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble