PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / acfe-term-functions.php
acf-extended / includes Last commit date
admin 3 months ago field-groups 3 months ago fields 1 week ago fields-settings 3 months ago forms 3 months ago locations 3 months ago modules 1 week ago screens 3 months ago acfe-deprecated-functions.php 2 years ago acfe-field-functions.php 3 months ago acfe-field-group-functions.php 3 months ago acfe-file-functions.php 1 year ago acfe-form-functions.php 3 months ago acfe-helper-array-functions.php 3 months ago acfe-helper-functions.php 3 months ago acfe-helper-multi-functions.php 3 months ago acfe-helper-string-functions.php 3 months ago acfe-meta-functions.php 3 months ago acfe-post-functions.php 3 months ago acfe-screen-functions.php 3 months ago acfe-template-functions.php 3 months ago acfe-term-functions.php 3 months ago acfe-user-functions.php 3 months ago acfe-wp-functions.php 3 years ago assets.php 3 months ago compatibility-acf-5.8.php 4 months ago compatibility-acf-5.9.php 3 months ago compatibility-acf-6.5.php 3 months ago compatibility-acf-6.8.6.php 1 week ago compatibility.php 3 months ago field-extend.php 4 months ago field.php 4 months ago hooks.php 3 months ago init.php 3 months ago local-meta.php 3 years ago media.php 3 months ago module-acf.php 3 months ago module-db.php 3 months ago module-l10n.php 3 months ago module-legacy.php 3 years ago module-manager.php 4 months ago module-post.php 3 months ago module-posts.php 4 months ago module-upgrades.php 3 years ago module.php 3 months ago multilang.php 3 months ago revisions.php 4 months ago screen.php 3 months ago settings.php 3 months ago template-tags.php 3 months ago third-party.php 3 years ago upgrades.php 3 months ago
acfe-term-functions.php
115 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 /**
8 * acfe_get_taxonomy_objects
9 *
10 * Query & retrieve taxonomies objects
11 *
12 * @param array $args
13 *
14 * @return array
15 */
16 function acfe_get_taxonomy_objects($args = array()){
17
18 // vars
19 $return = array();
20
21 // Post Types
22 $taxonomies = acf_get_taxonomies($args);
23
24 // Choices
25 if(!empty($taxonomies)){
26
27 foreach($taxonomies as $taxonomy){
28
29 $taxonomy_object = get_taxonomy($taxonomy);
30
31 $return[ $taxonomy_object->name ] = $taxonomy_object;
32
33 }
34
35 }
36
37 return $return;
38
39 }
40
41 /**
42 * acfe_get_taxonomy_terms_ids
43 *
44 * Similar to acf_get_taxonomy_terms()
45 * Returns "array('256' => 'Category name')" instead of "array('category:category_name' => 'Category name')"
46 *
47 * @param array $taxonomies
48 *
49 * @return array
50 */
51 function acfe_get_taxonomy_terms_ids($taxonomies = array()){
52
53 // force array
54 $taxonomies = acfe_as_array($taxonomies);
55
56 // get pretty taxonomy names
57 $taxonomies = acf_get_taxonomy_labels($taxonomies);
58
59 // vars
60 $r = array();
61
62 // populate $r
63 foreach(array_keys($taxonomies) as $taxonomy){
64
65 // vars
66 $label = $taxonomies[ $taxonomy ];
67 $is_hierarchical = is_taxonomy_hierarchical($taxonomy);
68
69 $terms = acf_get_terms(array(
70 'taxonomy' => $taxonomy,
71 'hide_empty' => false
72 ));
73
74 // bail early if no terms
75 if(empty($terms)){
76 continue;
77 }
78
79 // sort into hierachial order!
80 if($is_hierarchical){
81 $terms = _get_term_children(0, $terms, $taxonomy);
82 }
83
84 // add placeholder
85 $r[ $label ] = array();
86
87 // add choices
88 foreach($terms as $term){
89 $r[ $label ][ $term->term_id ] = acf_get_term_title($term);
90 }
91
92 }
93
94 // return
95 return $r;
96
97 }
98
99 /**
100 * acfe_get_term_level
101 *
102 * Retrive the Term Level number
103 *
104 * @param $term
105 * @param $taxonomy
106 *
107 * @return int
108 */
109 function acfe_get_term_level($term, $taxonomy){
110
111 $ancestors = get_ancestors($term, $taxonomy);
112
113 return count($ancestors) + 1;
114
115 }