• In my code (index.php) I have this:

    <h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><img src=”<?php gravatar(the_author_email) ?>” alt=”Gravatar” />” rel=”bookmark”><?php the_title(); ?></h3>

    But the part I want to concentrate on is :
    <img src=”<?php gravatar(the_author_email) ?>” alt=”Gravatar” />

    Now as you know this is in the loop but when I use it the deafult avatar is shown. (Im using Skippy’s Gravatar Plug-in)

    Now when I type in <img src=”<?php gravatar([email protected]) ?>” alt=”Gravatar” /> the gravatar shows up. Why doesn’t the “the_author_email” work?

    EDIT:

    Changing this

    the_author_email
    to
    <?php the_author_email(); ?>

    gives this error

    Parse error: parse error, unexpected ‘<‘, expecting ‘)’ in /…/index.php on line 9

    EDIT:
    I also tried this:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    $email = ‘<?php the_author_email(); ?>’;
    ?>

    <div class=”post”>
    <h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><img src=”<?php gravatar($email) ?>” alt=”Gravatar” />” rel=”bookmark”><?php the_title(); ?></h3>

    Which didnt work

    EDIT:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    $email = ‘[email protected]’;
    ?>

    <div class=”post”>
    <h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><img src=”<?php gravatar($email) ?>” alt=”Gravatar” />” rel=”bookmark”><?php the_title(); ?></h3>

    That worked

    SUMMARY: Looks like the_author_email doesnt work

    EDIT:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    $email = ‘echo (<?php the_author_email();?>’;
    ?>

    Didnt work either

Viewing 15 replies - 1 through 15 (of 15 total)
  • i have no idea what you’re really trying to do, but you can’t have a php function within a php function like that. Once you start anything with a <?php you can’t use another <?php or else you’ll get errors.

    Thread Starter infnit

    (@infnit)

    The idea is I want to show a gravatar. The code to show it is

    <img src=”<?php gravatar([email protected]); ?>” alt=”altag” />

    Now to display the author’s email address in WP is <?php the_author_email() ?> so in essence I must put

    <img src=”<?php gravatar(<?php the_author_email() ?>); ?>” alt=”altag” />

    For the gravatar of each author to show which as lawtai said won’t work. Anyone got any solutions? Im using Skippy.net’s Gravatar 1.8 Plug-in

    THIS IS MY CURRENT CODE:

    <?php
    get_header();
    ?>

    <?php if (have_posts()) : while (have_posts()) : the_post();
    $email = ‘echo gravatar(the_author_email);’;
    ?>

    <div class=”post”>
    <h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><img class=”gravatar” src=”<?php gravatar($email) ?>” alt=”Gravatar” />” rel=”bookmark”><?php the_title(); ?></h3>
    <div class=”meta”>
    <?php _e(“Filed under:”); ?> <?php the_category(‘,’) ?> — <?php the_author() ?> at <?php the_time(‘g:i a’) ?> on <?php the_time(‘l, F j, Y’) ?> <?php edit_post_link(__(‘Edit This’)); ?></div>

    <div class=”storycontent”>
    <?php the_content(__(‘(Read on …)’)); ?>
    </div>

    <div class=”feedback”>
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>
    </div>

    <!–
    <?php trackback_rdf(); ?>
    –>

    </div>

    <?php comments_template(); ?>

    <?php endwhile; else: ?>
    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?>

    <?php posts_nav_link(‘ — ‘, __(‘« Previous Page’), __(‘Next Page »’)); ?>

    <?php get_footer(); ?>

    well, have you tried <?php gravatar(the_author_email()); ? >

    with the () after the_author_email?

    * note the space i put in at the end which you should tak eout

    Thread Starter infnit

    (@infnit)

    nope will now ??

    Thread Starter infnit

    (@infnit)

    Grr. my host is really annoying! I keep getting “The operation timed out”

    Thread Starter infnit

    (@infnit)

    Sorry gave this error

    Parse error: parse error, unexpected ‘?’ in /…/index.php on line 11

    Used this code btw

    <img class=”gravatar” src=”<?php gravatar(the_author_email()); ? >” alt=”Gravatar” />

    Thread Starter infnit

    (@infnit)

    Anyone can help?

    Thread Starter infnit

    (@infnit)

    YAY got it!!!!
    Just had to go <img src=”wp-content/gravatars/<?php the_author_ID(); ?>ava.gif” class=”gravatar” alt=”gravatar />

    And then just save the gravatars as the authors id ava.gif

    For example admin is 1ava.gif

    I know it’s not the best but it works ??

    the_author_email() automatically echoes (or outputs) the author’s email, so it is not the function you want to use. Try instead get_the_author_email():

    <?php if (function_exists('gravatar') {
    echo "<img class='gravatar' src='" . gravatar(get_the_author_email()) . "' alt='Gravatar' />";
    } ?>

    Thread Starter infnit

    (@infnit)

    :O O……Ill try that ??

    Thread Starter infnit

    (@infnit)

    Sorry didn’t work gave me an unexpected “{” error

    try:

    <img src="<?php gravatar(get_the_author_email()) ?>" alt="Gravatar" />

    I think that’s what you’re looking for… (and what skippy was referring to…)

    -d

    Thread Starter infnit

    (@infnit)

    Thanks, but Ive already set up everyone with their ava1, 2 etc and they also think its better

    It works by the way for anyone who wants to use it ??

    I am trying to get an author’s gravatar to show up on an author’s profile page. None of the comments here worked for me, so I thought I would show you the code that worked for me in case anyone else runs into this problem. This is the code I put in my auther template:


    <?php echo "<img src='";
    echo gravatar($curauth->user_email);
    echo "' alt='' class='gravatar' width='80' height='80' HSPACE=10 ALIGN=RIGHT />"; ?>

    Thanks davidchait, WOW this was like pulling teeth, but I finally got the Skippy Avatar to work using the

    <img src=”<?php gravatar(get_the_author_email()) ?>” alt=”Gravatar” />

    Using the “Connections Theme” I pasted the above snippet into the index.php and it worked…

    I’ll play with the “prettiness” by myself

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Gravatar is “Posts” ?’ is closed to new replies.