basic-settings.php
4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
global $acf_taxonomy;
acf_render_field_wrap(
array(
'label' => __( 'Plural Label', 'acf' ),
/* translators: example taxonomy */
'placeholder' => __( 'Genres', 'acf' ),
'type' => 'text',
'key' => 'name',
'name' => 'name',
'class' => 'acf_plural_label',
'prefix' => 'acf_taxonomy[labels]',
'value' => $acf_taxonomy['labels']['name'],
'required' => 1,
),
'div',
'field'
);
acf_render_field_wrap(
array(
'label' => __( 'Singular Label', 'acf' ),
/* translators: example taxonomy */
'placeholder' => __( 'Genre', 'acf' ),
'type' => 'text',
'key' => 'singular_name',
'name' => 'singular_name',
'class' => 'acf_slugify_to_key acf_singular_label',
'prefix' => 'acf_taxonomy[labels]',
'value' => $acf_taxonomy['labels']['singular_name'],
'required' => 1,
),
'div',
'field'
);
acf_render_field_wrap(
array(
'label' => __( 'Taxonomy Key', 'acf' ),
'instructions' => __( 'Lower case letters, underscores and dashes only, Max 20 characters.', 'acf' ),
/* translators: example taxonomy */
'placeholder' => __( 'genre', 'acf' ),
'type' => 'text',
'key' => 'taxonomy',
'name' => 'taxonomy',
'maxlength' => 20,
'class' => 'acf_slugified_key',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['taxonomy'],
'required' => 1,
),
'div',
'field'
);
// Allow preselecting the linked post types based on previously created post type.
$acf_use_post_type = acf_get_post_type_from_request_args( 'create-taxonomy' );
if ( $acf_use_post_type && ! empty( $acf_use_post_type['post_type'] ) ) {
$acf_taxonomy['object_type'] = array( $acf_use_post_type['post_type'] );
}
acf_render_field_wrap(
array(
'label' => __( 'Post Types', 'acf' ),
'type' => 'select',
'name' => 'object_type',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['object_type'],
'choices' => acf_get_pretty_post_types(),
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'instructions' => __( 'One or many post types that can be classified with this taxonomy.', 'acf' ),
),
'div',
'field'
);
acf_render_field_wrap( array( 'type' => 'seperator' ) );
acf_render_field_wrap(
array(
'type' => 'true_false',
'key' => 'public',
'name' => 'public',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['public'],
'label' => __( 'Public', 'acf' ),
'instructions' => __( 'Makes a taxonomy visible on the frontend and in the admin dashboard.', 'acf' ),
'ui' => true,
'default' => 1,
)
);
acf_render_field_wrap(
array(
'type' => 'true_false',
'key' => 'hierarchical',
'name' => 'hierarchical',
'class' => 'acf_hierarchical_switch',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['hierarchical'],
'label' => __( 'Hierarchical', 'acf' ),
'instructions' => __( 'Hierarchical taxonomies can have descendants (like categories).', 'acf' ),
'ui' => true,
),
'div'
);
do_action( 'acf/taxonomy/basic_settings', $acf_taxonomy );
acf_render_field_wrap( array( 'type' => 'seperator' ) );
acf_render_field_wrap(
array(
'label' => __( 'Advanced Configuration', 'acf' ),
'instructions' => __( 'I know what I\'m doing, show me all the options.', 'acf' ),
'type' => 'true_false',
'key' => 'advanced_configuration',
'name' => 'advanced_configuration',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['advanced_configuration'],
'ui' => 1,
'class' => 'acf-advanced-settings-toggle',
)
);
?>
<div class="acf-hidden">
<input type="hidden" name="acf_taxonomy[key]" value="<?php echo esc_attr( $acf_taxonomy['key'] ); ?>" />
<input type="hidden" name="acf_taxonomy[import_source]" value="<?php echo esc_attr( $acf_taxonomy['import_source'] ); ?>" />
<input type="hidden" name="acf_taxonomy[import_date]" value="<?php echo esc_attr( $acf_taxonomy['import_date'] ); ?>" />
</div>
<?php