$choice_label){
$final_choices[$choice] = $choice_label;
$final_choices[$choice . '_archive'] = $choice_label . ' Archive' . ($choice == 'all' ? 's' : '');
}
$choices = $final_choices;
return $choices;
}
/**
* ACFE Location: Taxonomy Archive Save
*/
add_action('load-edit-tags.php', 'acfe_location_taxonomy_archive_save');
function acfe_location_taxonomy_archive_save(){
// Enqueue ACF JS
acf_enqueue_scripts();
// Success message
if(isset($_GET['message']) && $_GET['message'] == 'acfe_taxonomy_archive')
acf_add_admin_notice('Options have been saved', 'success');
// Verify Nonce
if(!acf_verify_nonce('taxonomy_archive_options'))
return;
// Get taxonomy
global $taxnow;
// Check taxonomy
$taxonomy = $taxnow;
if(empty($taxonomy))
return;
// Validate
if(acf_validate_save_post(true)){
// Autoload
acf_update_setting('autoload', false);
// Save
acf_save_post('tax_' . $taxonomy . '_options');
// Redirect
wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_archive')));
exit;
}
}
/**
* ACFE Location: Taxonomy Archive Footer
*/
add_action('admin_footer', 'acfe_location_taxonomy_archive_footer');
function acfe_location_taxonomy_archive_footer(){
// Check current screen
global $pagenow;
if($pagenow !== 'edit-tags.php')
return;
// Get taxonomy
global $taxnow;
// Check taxonomy
$taxonomy = $taxnow;
if(empty($taxonomy) || !in_array($taxonomy, acf_get_taxonomies()))
return;
// Get field groups
$field_groups = acf_get_field_groups(array(
'taxonomy' => 'all_archive'
));
if(empty($field_groups)){
$field_groups = acf_get_field_groups(array(
'taxonomy' => $taxonomy . '_archive'
));
}
if(empty($field_groups))
return;
?>