Kaneda
Kaneda

Reputation: 51

Adding PHP mixed with HTML

I guess this is really simple for you guys but I have been trying to make this work for hours now and have yet to succeed.

I am trying to modify the comments template for a WordPress theme. All I want to do is add a specific piece of PHP code so that the avatar of the user in the comments section will have a link.

The original code to display the avatar in WordPress is:

<div class="comment-avatar"><?php echo get_avatar( $comment, 65 ); ?></div>

All I need to do now is add the following PHP code to the above line:

<a href="'.$userpro->permalink( $comment->user_id ).'">' XXX </a>

XXX is where the first line of code should go. Since this is a mix of PHP and HTML, I get very confused.

Can any of you guys please help me out on this one? I would appreciate it a lot :)

Upvotes: 0

Views: 77

Answers (2)

James John
James John

Reputation: 415

This is what you are trying to do

<a href="<?php echo $userpro->permalink( $comment->user_id )?>">
    <div class="comment-avatar"><?php echo get_avatar( $comment, 65 ); ?></div>
</a>

Upvotes: 1

Andrew Berger
Andrew Berger

Reputation: 56

echo '<a href="'.$userpro->permalink( $comment->user_id ).'"><div class="comment-avatar">' . get_avatar( $comment, 65 ) . '</div></a>';

Upvotes: 0

Related Questions