我无法在WordPress功能中显示标题链接。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>';
它会显示标题,但不会显示为链接。
任何想法?您的帮助将不胜感激。
Thnx!
@cale_b你的答案是正确的patially。我在编辑过程中遇到过双引号,但是有些时候我忘了将它们放回原处。这是正确的答案:http://stackoverflow.com/a/22182574/742030 – CelticParser