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-post-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-post-functions.php
147 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 /**
8 * acfe_get_post_types
9 *
10 * Query & retrieve post types
11 *
12 * @param array $args
13 *
14 * @return array
15 */
16 function acfe_get_post_types($args = array()){
17
18 // vars
19 $return = array();
20
21 // extract special args
22 $include = acf_extract_var($args, 'include');
23 $include = acfe_as_array($include);
24
25 // get post types
26 $posts_types = acf_get_post_types($args);
27
28 // allow to retrieve post when has_archive is true
29 if(!empty($args['has_archive'])){
30
31 // check post has archive
32 $post_archive = get_option('show_on_front') === 'posts' || (get_option('show_on_front') === 'page' && get_option('page_for_posts'));
33
34 // append post
35 if($post_archive && !in_array('post', $posts_types)){
36 $posts_types[] = 'post';
37 }
38
39 }
40
41 // loop
42 foreach($posts_types as $post_type){
43
44 // validate include
45 if(!empty($include) && !in_array($post_type, $include)){
46 continue;
47 }
48
49 // append
50 $return[] = $post_type;
51
52 }
53
54 // return
55 return $return;
56
57 }
58
59 /**
60 * acfe_get_post_type_objects
61 *
62 * Query & retrieve post types objects
63 *
64 * @param array $args
65 *
66 * @return array
67 */
68 function acfe_get_post_type_objects($args = array()){
69
70 // vars
71 $return = array();
72
73 // get post types
74 $posts_types = acfe_get_post_types($args);
75
76 // loop
77 foreach($posts_types as $post_type){
78
79 // get object
80 $object = get_post_type_object($post_type);
81
82 // append
83 $return[ $object->name ] = $object;
84
85 }
86
87 // return
88 return $return;
89
90 }
91
92 /**
93 * acfe_get_pretty_post_statuses
94 *
95 * Similar to acf_get_pretty_post_types() but for Post Statuses
96 *
97 * @param array $posts_statuses
98 *
99 * @return array
100 */
101 function acfe_get_pretty_post_statuses($posts_statuses = array()){
102
103 // vars
104 $ref = array();
105 $return = array();
106
107 // get post statuses
108 if(empty($posts_statuses)){
109 $posts_statuses = get_post_stati();
110 }
111
112 // loop
113 foreach($posts_statuses as $post_status){
114
115 // vars
116 $object = get_post_status_object($post_status);
117 $label = $object->label;
118
119 // append to return
120 $return[ $object->name ] = $label;
121
122 // increase counter
123 if(!isset($ref[ $label ])){
124 $ref[ $label ] = 0;
125 }
126
127 $ref[ $label ]++;
128
129 }
130
131 // get slugs
132 foreach(array_keys($return) as $slug){
133
134 // vars
135 $label = $return[ $slug ];
136
137 // append slug
138 if($ref[ $label ] > 1){
139 $return[ $slug ] .= " ({$slug})";
140 }
141
142 }
143
144 // return
145 return $return;
146
147 }