【发布时间】:2011-09-21 17:33:34
【问题描述】:
我目前正在使用 wordpress 功能来显示特定类别的帖子。 简化的示例如下所示:
<?php query('cat_name=cat1&posts=1') ?>
基本上这会从 cat1 类别中获得 1 个帖子。 但是我保存了一个变量来获取当前类别(这是在类别页面上):
<?php $thiscat = get_the_category(); ?>
Current Category: <?php echo $thiscat ?>
我现在如何将变量 $thiscat 回显到上面查询的参数中,以便为我填写类别名称?此函数应用于不同的类别页面,因此将其自动传递给我的查询参数可以节省很多麻烦。
提前感谢您的帮助。
【问题讨论】: