Topic: HoverCards from Gravatar.com

Just put the line

wp_enqueue_script( 'gprofiles', get_template_directory_uri().'/js/gprofiles.js', 'jquery', 'e', true);

in header.php below

wp_enqueue_script('jquery-ui-tabs', null, array('jquery-ui-core', 'jquery'), null, false);

.

Please note that the gravatar's js file is on my localhost. if you want to directly insert the js file from gravatar's server, please paste the following line:

wp_enqueue_script( 'gprofiles', 'http://s.gravatar.com/js/gprofiles.js', 'jquery', 'e', true);

It is a great future provided by Gravatar

Supporting Arras for Romanian public! Updates of Romanian version for Arras can be found here. You can visit my WordPress support project to see the power of Romanian Arras!

Re: HoverCards from Gravatar.com

Or just put in functions.php (of a child theme or the theme's functions.php)

function hovercards() {

        wp_enqueue_script( 'gprofiles', 'http://s.gravatar.com/js/gprofiles.js', 'jquery', 'null', true);
}

add_action('wp_print_scripts', 'hovercards');

Note:  WordPress discourages using 'wp_print_scripts', but somehow it works just fine in Arras. If you're not sure use 'init' instead.
The advantage of using wp_print_scripts is you can use conditional tags like is_home() or is_single() while those conditional tags aren't available during init.

Last edited by extatix (2010-10-22 05:22:40)

My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: HoverCards from Gravatar.com

well, it is better to do it in my way because all the files are in the same DNS and you'll beneffit of hovercards advantages wherever are gravatar in blogs (even homepage). I recomand not to use function.php for this function because the processing is a little bit faster and the loading time is better smile

Supporting Arras for Romanian public! Updates of Romanian version for Arras can be found here. You can visit my WordPress support project to see the power of Romanian Arras!

Re: HoverCards from Gravatar.com

Yeah, apart from what you are saying isn't true. It uses the same function 'wp_enqueue_script' to load it.

My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: HoverCards from Gravatar.com

And additionaly: if you want to use the code provided by dumbravaandrei you should consider where the script is needed, most likely only on single posts and pages ('cause there's where the comments are).

if (is_single || is_page)) {
wp_enqueue_script( 'gprofiles', 'http://s.gravatar.com/js/gprofiles.js', 'jquery', 'null', true);
}

Or a self-hosted one:

if (is_single || is_page)) {
wp_enqueue_script( 'gprofiles', get_template_directory_uri().'/js/gprofiles.js', 'jquery', 'null', true);
}
My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: HoverCards from Gravatar.com

tongue But what if you have a tabbed sidebar with avatars of commentors? big_smile

also you can include static this script with <script> tag.

Last edited by dumbravaandrei (2010-10-22 07:51:38)

Supporting Arras for Romanian public! Updates of Romanian version for Arras can be found here. You can visit my WordPress support project to see the power of Romanian Arras!

Re: HoverCards from Gravatar.com

Then you don't use conditional tags smile

My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: HoverCards from Gravatar.com

Which Arras version does this apply to? I've tried it with Arras 1.5.1.2 and it doesn't seem to work.

Thumbs up

Re: HoverCards from Gravatar.com

Actually, it turns out there is no need to do any of this. There is a Gravatar Hovercard plugin that can easily be installed and it works with Arras 1.5.1.2. No code modification needed.

Thumbs up