我是一个有用的助手,可以翻译文本。
它将显示标题,但不作为链接。
有什么想法吗?感谢您的帮助。
谢谢!
我在WordPress函数中遇到了将标题显示为链接的问题。
如果我像这样编码:
function my_popular_posts($count) {
$query = new WP_Query( array(
'orderby' => 'comment_count',
'order' => 'DESC',
'posts_per_page' => $count));
if($query->have_posts()) {
echo '<ul>';
while($query->have_posts()) : $query->the_post();
**THIS LINE --> echo '<li><a href='.get_permalink().'> .the_title(). </a></li>';
endwhile;
echo '</ul>';
} else {
echo "<p>No popular posts found<p>";
}
}
在运行时,该链接会显示为“.the_title()”。
如果我这样编写代码:
echo '<li><a href='.get_permalink().'>'.the_title().'</a></li>';
它将显示标题,但不作为链接。
有什么想法吗?感谢您的帮助。
谢谢!
get_the_title()
。 - Someone