admin管理员组文章数量:1332628
I have an advanced custom fields field called job_type. It is a select type field so it has a number of values in the field like Contract, Freelance, Permanent etc. So I list all the jobs on a page and now I want to have exposed filters on the left where a user can choose to filter the jobs based on various fields. So for example if he chooses Freelance the page should (with ajax) show only the jobs that are of type 'Freelance'
How do I get the values from the field into a select list please?
I have an advanced custom fields field called job_type. It is a select type field so it has a number of values in the field like Contract, Freelance, Permanent etc. So I list all the jobs on a page and now I want to have exposed filters on the left where a user can choose to filter the jobs based on various fields. So for example if he chooses Freelance the page should (with ajax) show only the jobs that are of type 'Freelance'
How do I get the values from the field into a select list please?
Share Improve this question edited Jul 14, 2020 at 6:54 calvincani asked Jul 14, 2020 at 6:41 calvincanicalvincani 1011 bronze badge1 Answer
Reset to default 0If you mean an ACF select field:
<?php
$field = get_field_object('my_select');
var_dump( $field['choices'] );
?>
More info here https://www.advancedcustomfields/resources/get_field_object/
本文标签: Get values from an advanced custom field
版权声明:本文标题:Get values from an advanced custom field 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742264372a2443109.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论