WordPress:如何将the_title显示为链接

 光头之祖_617 发布于 2023-01-20 06:54

我在将标题显示为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 '
    '; while($query->have_posts()) : $query->the_post(); **THIS LINE --> echo '
  • .the_title().
  • '; endwhile; echo '
'; } else { echo "

No popular posts found

"; } }

在运行时,链接显示为".the_title()"

如果我这样编码:

echo '
  • '.the_title().'
  • ';

    它将显示标题,但不显示链接.

    有任何想法吗?我们将不胜感激.

    日Thnx!

    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    热门标签
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有