我在WP博客上有一个作者的链接。但在查看页面时,链接会与其他文本融为一体。我希望观众知道作者的名字是一个可点击的链接,如果他们想查看作者的个人资料,可以点击该链接。
所以代码片段是:
<div class="postdate">
<?php the_time('l, F jS, Y') ?> by
<?php the_author_posts_link(); ?>
at
<?php the_time() ?>
</div>
因此,我当然必须对_author_posts_link行执行一些操作。但我不确定如何在其中添加一些内容,例如style="text-decoration:underline"之类的内容,所以它在php中是可以接受的。如有任何这方面的信息或指导,我们将不胜感激!
澄清
以前,输出是这样的:
Thursday, February 14th, 2013 by Jason+ at 10:05 am
在建立了Alien先生提供的css片段后,输出是相同的:
Thursday, February 14th, 2013 by Jason+ at 10:05 am
但当我悬停在它上面时,它确实下划线了,这很奇怪。我希望它在悬停在上面之前加下划线,就我所看到的代码而言,这应该是正确的。
我不理解你的问题,但如果这个函数the_author_posts_link();
返回链接,那么你可以像这个一样执行
.postdate a {
text-decoration: underline; /* You can use !important declaration if you are
not getting the underline, perhaps something
must be overriding so... */
}