我使用这段代码,它可以工作:
if ( in_category( 'videos' )) {
echo '<span class="corner-tag blue">something else</span>';
}
但是在此代码中,如何添加 href 链接?
我尝试了这样的事情,但没有奏效:
if ( in_category( 'videos' )) {
echo '<span class="corner-tag blue" a href="http://google.com">something else</span></a>';
}
谢谢。
你需要
两个不同的标签,一个在另一个里面。 例如,您必须打开 <a>
标签并将其关闭在 <span>
标签中,反之亦然:
<span><a></a></span>
:
echo '<span class="corner-tag blue"><a href="http://google.com">something else</a></span>';
<a><span></span></a>
:
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>
<br/>
<span class="corner-tag blue"><a href="http://google.com">something else</a></span>