【发布时间】:2019-01-07 16:24:35
【问题描述】:
我的知识非常有限,但我设法在自定义 functions.php 文件中添加了一个过滤器,以在发布内容之前显示一些自定义字段短代码:
//Insert custom event fields at the beginning of post content
function custom_event($content) {
$beforecontent = '<strong>[acf field="date"] [acf field="time"] [acf field="location" ] </strong>';
$fullcontent = $beforecontent . $content;
return $fullcontent;
}
add_filter('the_content', 'custom_event');
如果我想以帖子属于特定类别为条件,任何人都可以帮助我使用正确的语法吗?我想我可以使用 in_category('x') 函数,我只是不确定语法。我最终想在变量之间添加一些文本,以便显示
[日期] [时间] [地点]
适用于“活动”类别中的帖子。
感谢期待。
【问题讨论】:
标签: wordpress