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-archive.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-archive.php
99 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_location_post_type_archive')):
8
9 class acfe_location_post_type_archive extends acfe_location{
10
11 /**
12 * initialize
13 *
14 * @return void
15 */
16 function initialize(){
17
18 $this->name = 'post_type_archive';
19 $this->label = __('Post Type Archive', 'acfe');
20 $this->category = 'post';
21 $this->after = 'post_type';
22
23 }
24
25
26 /**
27 * rule_values
28 *
29 * @param $choices
30 *
31 * @return array
32 */
33 function rule_values($choices){
34
35 // get post types archives
36 $post_types = acf_get_post_types(array(
37 'acfe_admin_archive' => true
38 ));
39
40 // append pretty post types
41 $pretty_post_types = array();
42
43 if(!empty($post_types)){
44 $pretty_post_types = acf_get_pretty_post_types($post_types);
45 }
46
47 // merge choices
48 $choices = array('all' => __('All', 'acf'));
49 $choices = array_merge($choices, $pretty_post_types);
50
51 // return choices
52 return $choices;
53
54 }
55
56
57 /**
58 * rule_match
59 *
60 * @param $result
61 * @param $rule
62 * @param $screen
63 *
64 * $rule = array(
65 * 'param' => 'post_type_archive',
66 * 'operator' => '==',
67 * 'value' => 'my-post-type',
68 * )
69 *
70 * $screen = array(
71 * 'lang' => false,
72 * 'ajax' => false,
73 * 'options_page' => 'my-post-type-archive',
74 * 'acfe_post_type_archive' => true,
75 * )
76 *
77 * @return bool
78 */
79 function rule_match($result, $rule, $screen){
80
81 // validate screen & rule
82 if(!acfe_get($screen, 'options_page') || !acfe_get($screen, 'acfe_post_type_archive') || !acfe_get($rule, 'value')){
83 return $result;
84 }
85
86 // prepare compare
87 $value = $screen['options_page'];
88 $rule['value'] = "{$rule['value']}-archive";
89
90 // compare $value with $rule['value']
91 return $this->compare($value, $rule);
92
93 }
94
95 }
96
97 acf_register_location_rule('acfe_location_post_type_archive');
98
99 endif;