Gravatar Support Page » Support » WP-Gravatar for standard WordPress

Gravatar in Title of Post instead of body?

(7 posts)
Started 2 months ago by nbauman Latest reply from rune This topic is not resolved

Has anyone modified this code to display the gravatar before the title, instead of before the body content when displaying gravatars with the post?

Thanks.

Posted 2 months ago #

Hi!

That should not be to difficult. You could try to change the code add_filter('the_content', 'show_gravatar_post',1); to read add_filter('the_title', 'show_gravatar_post',1);.

This should make the plugin show the gravatar before the title of the post.

Posted 2 months ago #

steve35mm
Member

This is of pertinent interest to a project I'm working on ;)

I tried your suggested code, but it places the gravatar all over the page, i.e. in the sidebar, etc. I like to appear just in the post title. Is there anyway to get it to appear just in the post title?

Thanks in advance!

Posted 2 months ago #

You might have to do check if you are in the_loop before hooking in to the the_title. If you're not checking that, the plugin will show the Gravatar every time WP shows the title of a post.

I've not tried to do that my self, so I can't give you any code.

Sorry :-)

Posted 2 months ago #

steve35mm
Member

Thanks for the quick response. My impression was that I was supposed to be editing the gravatar.php code of the plugin. If this is the case, I don't have control of the loop.

With that being said, is there actual code (something like a wordpress template tag) I can manually place in the html of the templates (i.e. archive.php, index.php, single.php, etc ) to display the gravatar where I want it to be displayed?

That would be amazing.

Thanks again.

Posted 2 months ago #

No, you don't have to alter the WordPress files, but you might have to edit the wp-gravatar code to check that it only places a gravatar when you're in the_loop.

I have no plans to change the plugin so users can put code in their template files. My goal is to have a plugin that does not need to have template files edited. I'm sorry.

Posted 2 months ago #

No, you don't have to alter the WordPress files, but you might have to edit the wp-gravatar code to check that it only places a gravatar when you're in the_loop.

I have no plans to change the plugin so users can put code in their template files. My goal is to have a plugin that does not need to have template files edited. I'm sorry.

Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser