查询帖子数组中的 WP Advanced 自定义字段值
WP Advanced custom field value in query posts array
我需要将页面中的高级自定义字段值(类别编号)放入 query_posts 数组。有可能吗?
在单个页面上,我试图显示类别中的帖子,哪个数字是此自定义字段的值。
理想的当然是非功能性案例:
query_posts(array('category__and'=>array( the_field("category"); ,99), 'posts_per_page'=>6));
the_field()
显示 元值。您需要使用 get_field()
(其中 returns 是一个元值):
query_posts(array('category__and'=>array( get_field("category"); ,99), 'posts_per_page'=>6));
有些无关的新闻,你真的应该考虑avoiding the use of query_posts
。
我需要将页面中的高级自定义字段值(类别编号)放入 query_posts 数组。有可能吗?
在单个页面上,我试图显示类别中的帖子,哪个数字是此自定义字段的值。
理想的当然是非功能性案例:
query_posts(array('category__and'=>array( the_field("category"); ,99), 'posts_per_page'=>6));
the_field()
显示 元值。您需要使用 get_field()
(其中 returns 是一个元值):
query_posts(array('category__and'=>array( get_field("category"); ,99), 'posts_per_page'=>6));
有些无关的新闻,你真的应该考虑avoiding the use of query_posts
。