I need to add this HTML tag:
<img src = "<?php echo esc_url( get_avatar_url( $post->post_author ) ); ?>" />
Inside PHP:
echo '<h3 >',
$current_cat->name,
" di ",
'<a href="' . $vendor_link->get_shop_url() . '" >',
get_usermeta( $post->post_author, 'dokan_store_name' ),
'</span>',
'</h3>';
I have to insert that image in PHP, but it always generates syntax errors.
CodePudding user response:
Based on:
<img src = "<?php echo esc_url(get_avatar_url($post->post_author));?>" />
Detect the PHP part:
esc_url(get_avatar_url($post->post_author))
Detect the HTML part:
<img src = "
//and
" />
Write it in PHP:
echo '<img src = "'.esc_url(get_avatar_url($post->post_author)).'" />';
And you should better use .
for concating things.
Its ok to use ,
when you echo
stuff.
But if you replace echo
with an assignment $var =
, you have to replace all ,
with .
to get it work again.
So always use .
.