Wordpress ACF->查询页面模板而不是帖子。
因此,基本上我已经设置了高级自定义字段,我想构建我的网站,这样当我创建一个页面模板为"主题页面"的页面时,我希望ACF将自定义字段添加到所有页面模板为"主题页面"的页面中。
在过去,我会使用$args
数组来查询post_type = 'slug'
;但是,如何查询页面模板?
查询帖子类型的现有代码:
$args = array( 'post_type' = 'the name of the post type' ); $args = new WP_Query( $args );
所以我想修改它,以便能够引用页面模板中的字段。
谢谢。
要查询页面,可以将post_type设置为'page':
'post_type' => 'page'