• Hello,

    Can someone tell me how I can put a div around the gravatar and the commenter name? Here’s the PHP code;

    // Produces an avatar image with the hCard-compliant photo class
    function commenter_link() {
        $commenter = get_comment_author_link();
        if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
            $commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter );
        } else {
            $commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );
        }
        $avatar_email = get_comment_author_email();
        $avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 32 ) );
        echo $avatar . ' <span class="commentername">' . $commenter . '</span>';
    } // end commenter_link

    The specific part where I would want the divs to be is;
    echo $avatar . ' <span class="commentername">' . $commenter . '</span>';

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • like so?

    echo '<div>' . $avatar . ' <span class="commentername">' . $commenter . '</span></div>';

    or with a specific css class (example css class .commenter-avatar):

    echo '<div class="commenter-avatar">' . $avatar . ' <span class="commentername">' . $commenter . '</span></div>';
    Thread Starter abfchgirlx

    (@abfchgirlx)

    Thank you. ?? It worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to place a div around the gravatar & commentor name’ is closed to new replies.