Community Forums › Forums › Archived Forums › Design Tips and Tricks › Positioning an author gravatar near a post title
Tagged: gravatar, gravatar positioning
- This topic has 22 replies, 5 voices, and was last updated 11 years, 11 months ago by lliillaa.
-
AuthorPosts
-
November 27, 2012 at 8:16 am #1832MikeMember
I have a number of clients who routinely request to have their (or one of their authors) gravatar positioned beside (or near) the post title on a single post page? Also, how would I include it in a category archive page which displays a list of 5 articles with snippets?
What is the easiest way to do this? Thanks All!
November 27, 2012 at 9:45 am #1849SoZoMemberIf you aren't familiar with functions and would rather not edit functions.php then you could use Genesis Simple Hooks and add it to the before_post_title hook
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
November 27, 2012 at 10:01 am #1860MikeMemberI wouldn't have a problem editing the functions.php file. Can you provide the code?
Thanks SoZo!
November 27, 2012 at 10:32 am #1872SoZoMemberWhat code are you referring to?
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
November 27, 2012 at 10:35 am #1874MikeMemberIf its not code, then the edits required to the functions.php file you mentioned to enable the functionality I describe.
November 27, 2012 at 10:37 am #1876SoZoMemberAdding a function would go something like
add_action('genesis_before_post_title', 'your_function');
function your_function() {
STUFF YOU WANT THE FUNCTION TO OUTPUT
}
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
November 27, 2012 at 10:47 am #1878MikeMemberOk, I'm not a programmer so I can't decipher this. Let's try the other avenue. What would I need to add to the before_post_title hook to get the functionality I'm looking for?
November 27, 2012 at 11:50 am #1888SoZoMemberI don't have that code memorized. I imagine a google search would bring it up though.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
December 8, 2012 at 11:35 am #3861DebsParticipantI don’t have that code memorized. I imagine a google search would bring it up though.
oh dear...not helpful...and just a tad sarcastic methinks... most people come here when they can't find answers on google...!
this might help from the old forum! Add Gravatar to Post Title [Tutorial]
December 9, 2012 at 1:14 pm #4019MikeMemberDebs,
Maybe this will help. It's from Nick in reponse to my email inquiring as to how much support I should expect or not expect as the case may be as a Pro-Plus member. This was prompted by this ticket.
Take it for what it is.
Best Regards,
Mike
*****
Mike,
We can help with usage and technical support in help desk. We have always relied on forum support for customizations. This allows the community to help and benefit.
To help get you started with the info John gave you, use get_avatar()
http://codex.wordpress.org/Function_Reference/get_avatarNick
December 9, 2012 at 1:25 pm #4021MikeMemberOh and thanks Debs! I didn't see your link at the bottom. I came up with a different solution so all is good. Thanks again!
- Mike
December 9, 2012 at 1:28 pm #4022DebsParticipanthi mike - glad you got that sorted!
December 9, 2012 at 1:32 pm #4023DebsParticipantactually mike...could you share what you did here? thanks!
December 9, 2012 at 1:48 pm #4025MikeMemberSure.
I did what SoZo suggested and googled "Using Gravatars in WordPress" and came across Bill Richardson's blog, a well respected developer in both Genesis and Thesis. Bill had an article on this at http://www.billerickson.net/using-gravatars-in-wordpress/
I kinda took the long way around but Bill made it easy to understand and since Thesis has recently released version 2, I bought the developer version. It is a lot different than Genesis but extremely powerful for the person like me who is not a novice but isn't a full-fledged developer either. I like owning both Genesis & Thesis as each framework has its strengths and weaknesses. Another tool in the toolset.
All that said, my client was more than happy so all ended well.
Best Regards,
Mike
December 10, 2012 at 4:04 am #4132DebsParticipantthanks mike, that's helpful...i've been a thesis user for many years and have only recently joined the genesis community...
December 10, 2012 at 8:40 am #4160MikeMemberCool. So I'm not telling you anything new. Thanks again for your guidance. It is much appreciated.
December 30, 2012 at 5:42 pm #8477lliillaaMemberI really want to do this. Area you saying the only way you could figure it out is to buy and use Thesis instead of Genesis. I'm pretty new at WordPress and need a little more assistance. Is this possible to do?
December 30, 2012 at 5:54 pm #8480SusanModeratorDebs linked to a tutorial, but you may not have access to it, so I've taken the liberty of including this here:
http://www.studiopress.com/support/showthread.php?t=82871&highlight=author+gravatar+post+title
From user AnoopSudhakaran on the old forum
Paste the following code in functions.php of your Child Theme to enable the Gravatar in the Post Title on all pages (Single Post,Homepage etc.):
Note: Change the 25 to the size of Gravatar you want.
function title_avatars() { ?>
<div id="avatar-title">
<?php echo get_avatar( get_the_author_id() , 25 ); ?>
</div>
<?php }
add_action('genesis_post_title', 'title_avatars');If you would like to add it only on the Homepage then use this code:
function title_avatars() {
if (is_home())
{ ?>
<div id="avatar-title">
<?php echo get_avatar( get_the_author_id() , 25 ); ?>
</div>
<?php } }
add_action('genesis_post_title', 'title_avatars');If you want to get Gravatar only on Single Pages:
function title_avatars() {
if (is_single())
{ ?>
<div id="avatar-title">
<?php echo get_avatar( get_the_author_id() , 25 ); ?>
</div>
<?php } }
add_action('genesis_post_title', 'title_avatars');Style it using CSS
#avatar-title {CSS HERE} [Tip : Use Firebug to edit in realtime]
December 31, 2012 at 8:37 am #8592MikeMemberThank you for the follow up on this topic Susan. It is much appreciated and very helpful for any future projects that may require Genesis.
December 31, 2012 at 10:35 am #8601lliillaaMemberThank you for copying and pasting the information, but just to be certain, I actually manually add this to the bottom of the functions.php file of the child theme even though it states at the top of the file not to make changes to it under any circumstances? I can't add it using the Custom Code portion of the Genesis settings?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.