gpt4 book ai didi

wordpress - 获取wordpress中搜索结果的总数

转载 作者:行者123 更新时间:2023-12-03 20:30:08 25 4
gpt4 key购买 nike

如何在wordpress的搜索结果页面中获取结果总数......我想我的问题很清楚。我需要搜索结果页面中显示的搜索结果总数。还需要找到总数页面和帖子的结果分开
我试过的是

    <?php echo count($posts); ?>

通过使用它,我得到了搜索结果的总数。但我还需要搜索结果中的页数和帖子数

最佳答案

试试这个代码,

$allsearch = new WP_Query("s=$s&showposts=0"); 
echo $allsearch ->found_posts.' results found.';

希望这会帮助你。

更多请访问,

Result Count in WordPress

Display Search Result Count

关于wordpress - 获取wordpress中搜索结果的总数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50349511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com