I.Alex I.Alex - 2 years ago 116
PHP Question

How can I use span class and href link in php?

I use this code and it works:

if ( in_category( 'videos' )) {
echo '<span class="corner-tag blue">something else</span>';

But in this code how can I add an href link?

I try something like this but it didn't work:

if ( in_category( 'videos' )) {
echo '<span class="corner-tag blue" a href="http://google.com">something else</span></a>';


Answer Source

you need two different tags, one inside the other. for example, you have to open the <a> tag and close it inside your <span> tag, or vice a versa:


echo '<span class="corner-tag blue"><a href="http://google.com">something else</a></span>';


echo '<a href="http://google.com"><span class="corner-tag blue">something else</span></a>';

<a href="http://google.com"><span class="corner-tag blue">something else</span></a>


<span class="corner-tag blue"><a href="http://google.com">something else</a></span>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download