【发布时间】:2014-05-26 09:17:55
【问题描述】:
我正在尝试显示:
- 链接的类别标题
- 类别说明(修剪为自定义长度)
- 类别“阅读更多样式链接
- 该类别中的帖子标题列表,链接到帖子
我已经使用 Foreach 循环完成了任务 1-3,但我似乎无法通过我过去使用的方法在每个类别中显示帖子标题。主要是我不知道如何运行 get_posts();或类似的函数,在 $args 数组中有一个变量。
我觉得这确实需要使用 foreach 循环来完成,因为我正在使用 20 多个类别。我已经尝试与第 3 方简码插件混合/匹配,但由于“wp 操作的顺序”,这个想法也失败了:(任何帮助都将非常感谢,因为我在过去 3 年一直在旋转我的轮子-4 小时。
源代码→ http://pastebin.com/Mm9u27dF
代码输出:
<p class="topic-link-heading"><a href="http://localhost:81/wordpress/?cat=3" id="topic-link">Understanding Democratic Governance and Market Economy</a></p><p class="topic-list">There is an ongoing debate in academic circles and among practitioners on the linkages between democratic governance and market economies. It has intensified in light of transitions taking place after the fall of the Berlin Wall. Amidst expectations that all &hellip; <a href="http://localhost:81/wordpress/?cat=3" > Topic Overview &rarr;</a></p>3
请注意
显示“3”只是为了表明类别 ID 变量输出正确
【问题讨论】:
标签: php wordpress foreach wordpress-theming