how to replace img inside href on this php code
this is the img code
<img class="img-responsive" src="<?php bloginfo('template_url');?>/images/<?php echo $term->name;?>.png" alt="<?php echo $term->name;?>">
i wanna replace it inside href in this code
<?php
echo '<a href="?cat='.$term->term_id.'">
<i class="fa fa-youtube-play fa-5x" aria-hidden="true"></i>
</a>';
echo "</div>";
}
?>
I tried this:
<?php echo '<a href="?cat='.$term->term_id.'"> <i class="fa fa-youtube-play fa-5x" aria-hidden="true"></i> <img class="img-responsive" src="<?php bloginfo('template_url');?>/images/<?php echo $term->name;?>.png" alt="<?php echo $term->name;?>"> </a>'; echo "</div>"; } ?>
You can't mix <?php
into echo
-- that's used for getting back into PHP execution mode when you're outputting raw text, but you're already in PHP execution.
Since bloginfo()
echoes its output instead of returning a string, you need to split this up into multiple statements.
<?php
echo '<a href="?cat='.$term->term_id.'"> <i class="fa fa-youtube-play fa-5x" aria-hidden="true"></i> <img class="img-responsive" src="';
bloginfo('template_url');
echo '/images/'.$term->name.'.png" alt="'.$term->name.'"> </a>';
echo "</div>";