我有这样的PHP代码片段:如何在html中正确插入此php代码片段?
<div class="overlay-content">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<i class="fa fa-search"></i></a>
</div>
我想删除:
<i class="fa fa-search"></i>
,而是,插入title属性,通过PHP,在目前的字体 - 真棒图标称为坐在超链接内。这样,当访问者悬停在项目上时,他们将看到标题而不是Font Awesome搜索图标。
所以我已经试过:
<div class="overlay-content">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_title_attribute(); ?></a>
</div>
,那就是未成功的原因也许是PHP开发人员明显。我正在尝试做什么?任何指导,以帮助我正确实现这一点将不胜感激!
虽然我同意,这正是OP有... – jeroen
@ jeroen,的确如此。但是,如果在每个函数之前添加'echo'(但是删除它们不会),那就意味着其他东西是错误的。 – rnevius
是的,但是如何复制OP的确切代码来回答这个问题呢?我必须在这里错过一些东西,因为投票结果都是在这个地方...... – jeroen