ACF Options Page

PHP
function my_acf_op_init() {
  if( function_exists('acf_add_options_page') ) {
    acf_add_options_page(array(
      'page_title'    => __('設定'),
      'menu_title'    => __('設定'),
      'menu_slug'     => 'setting-my',
      'icon_url'      => 'dashicons-code-standards',
      'redirect'      => false
    ));
  }
}
add_action('acf/init', 'my_acf_op_init');

Tags:

Query the taxonomy terms by ACF field

PHP
<?php 
  $args = array(
    'taxonomy' => 'category',
    'hide_empty' => false
  );
  $cats = get_categories($args);
  $cats_has_feature = array();
  foreach($cats as $cat){
    if (get_field('term_is_feature', 'category_'.$cat->term_id)) {
      $cats_has_feature[] = $cat;	// save the match term in Array
    }
  }

Tags: