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 / locations / location-post-type-all.php
acf-extended / includes / locations Last commit date
location-post-type-all.php 3 months ago location-post-type-archive.php 3 months ago location-post-type-list.php 3 months ago location-taxonomy-list.php 3 months ago location.php 3 months ago
location-post-type-all.php
81 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_location_post_type_all')):
8
9 class acfe_location_post_type_all{
10
11 /**
12 * construct
13 */
14 function __construct(){
15
16 add_filter('acf/location/rule_values/post_type', array($this, 'rule_values'));
17 add_filter('acf/location/rule_match/post_type', array($this, 'rule_match'), 10, 3);
18
19 }
20
21
22 /**
23 * rule_values
24 *
25 * @param $choices
26 *
27 * @return string[]|void[]
28 */
29 function rule_values($choices){
30
31 return array_merge(array(
32 'all' => __('All', 'acf')
33 ), $choices);
34
35 }
36
37
38 /**
39 * rule_match
40 *
41 * @param $match
42 * @param $rule
43 * @param $options
44 *
45 * @return bool
46 */
47 function rule_match($match, $rule, $options){
48
49 // rule value might be empty
50 // in case a field group use a custom location type from third party plugin
51 // if the third party plugin is disabled, acf will fallback to "Post Type == ''"
52 // and pass thru this rule because it's the first one
53 if(empty($rule['value'])){
54 return $match;
55 }
56
57 if($rule['value'] !== 'all'){
58 return $match;
59 }
60
61 if(!acfe_get($options, 'post_type')){
62 return $match;
63 }
64
65 $post_types = acf_get_post_types();
66
67 $match = in_array($options['post_type'], $post_types);
68
69 if($rule['operator'] === '!='){
70 $match = !$match;
71 }
72
73 return $match;
74
75 }
76
77 }
78
79 acf_new_instance('acfe_location_post_type_all');
80
81 endif;