@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | 16 | if ( ! defined( 'WPINC' ) ) { |
17 | - die; |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | define( 'LSX_TO_VEHICLES_PATH', plugin_dir_path( __FILE__ ) ); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @category content |
15 | 15 | */ |
16 | 16 | function lsx_vehicle_content( $slug, $name = null ) { |
17 | - do_action( 'lsx_vehicle_content', $slug, $name ); |
|
17 | + do_action( 'lsx_vehicle_content', $slug, $name ); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /* ================ VEHICLES =========================== */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @category vehicle |
32 | 32 | */ |
33 | 33 | function lsx_vehicle_code( $before = '', $after = '', $echo = true ) { |
34 | - lsx_to_custom_field_query( 'code', $before, $after, $echo ); |
|
34 | + lsx_to_custom_field_query( 'code', $before, $after, $echo ); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Outputs the current vehicles vehicle_type. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @category vehicle |
47 | 47 | */ |
48 | 48 | function lsx_vehicle_type( $before = '', $after = '', $echo = true ) { |
49 | - lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo ); |
|
49 | + lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo ); |
|
50 | 50 | } |
51 | 51 | /** |
52 | 52 | * Outputs the current vehicles price. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @category vehicle |
62 | 62 | */ |
63 | 63 | function lsx_vehicle_price( $before = '', $after = '', $echo = true ) { |
64 | - lsx_to_custom_field_query( 'price', $before, $after, $echo ); |
|
64 | + lsx_to_custom_field_query( 'price', $before, $after, $echo ); |
|
65 | 65 | } |
66 | 66 | /** |
67 | 67 | * Outputs the current vehicles engine_type. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @category vehicle |
77 | 77 | */ |
78 | 78 | function lsx_vehicle_engine_type( $before = '', $after = '', $echo = true ) { |
79 | - lsx_to_custom_field_query( 'engine_type', $before, $after, $echo ); |
|
79 | + lsx_to_custom_field_query( 'engine_type', $before, $after, $echo ); |
|
80 | 80 | } |
81 | 81 | /** |
82 | 82 | * Outputs the current vehicles gearbox. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @category vehicle |
92 | 92 | */ |
93 | 93 | function lsx_vehicle_gearbox( $before = '', $after = '', $echo = true ) { |
94 | - lsx_to_custom_field_query( 'gearbox', $before, $after, $echo ); |
|
94 | + lsx_to_custom_field_query( 'gearbox', $before, $after, $echo ); |
|
95 | 95 | } |
96 | 96 | /** |
97 | 97 | * Outputs the current vehicles engine_size. |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @category vehicle |
107 | 107 | */ |
108 | 108 | function lsx_vehicle_engine_size( $before = '', $after = '', $echo = true ) { |
109 | - lsx_to_custom_field_query( 'engine_size', $before, $after, $echo ); |
|
109 | + lsx_to_custom_field_query( 'engine_size', $before, $after, $echo ); |
|
110 | 110 | } |
111 | 111 | /** |
112 | 112 | * Outputs the current vehicles gears. |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @category vehicle |
122 | 122 | */ |
123 | 123 | function lsx_vehicle_gears( $before = '', $after = '', $echo = true ) { |
124 | - lsx_to_custom_field_query( 'gears', $before, $after, $echo ); |
|
124 | + lsx_to_custom_field_query( 'gears', $before, $after, $echo ); |
|
125 | 125 | } |
126 | 126 | /** |
127 | 127 | * Outputs the current vehicles seating. |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @category vehicle |
137 | 137 | */ |
138 | 138 | function lsx_vehicle_seating( $before = '', $after = '', $echo = true ) { |
139 | - lsx_to_custom_field_query( 'seating', $before, $after, $echo ); |
|
139 | + lsx_to_custom_field_query( 'seating', $before, $after, $echo ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @category vehicle |
149 | 149 | */ |
150 | 150 | function lsx_has_vehicle_features() { |
151 | - return lsx_to_has_custom_field_query( 'features', get_the_ID() ); |
|
151 | + return lsx_to_has_custom_field_query( 'features', get_the_ID() ); |
|
152 | 152 | } |
153 | 153 | /** |
154 | 154 | * Outputs the Vehicles Custom Fields on the Single Vehicle Templates |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @category vehicle |
159 | 159 | */ |
160 | 160 | function lsx_vehicle_features() { |
161 | - if ( is_singular( 'vehicle' ) ) { |
|
162 | - $features = lsx_to_custom_field_query( 'features', '', '', false ); |
|
163 | - if ( null !== $features ) { ?> |
|
161 | + if ( is_singular( 'vehicle' ) ) { |
|
162 | + $features = lsx_to_custom_field_query( 'features', '', '', false ); |
|
163 | + if ( null !== $features ) { ?> |
|
164 | 164 | <section id="features"> |
165 | 165 | <div class="row"> |
166 | 166 | <?php if ( null !== $features ) { ?> |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | <h3 class="section-title"><?php esc_html_e( 'Features', 'to-vehicles' ); ?></h3> |
169 | 169 | <div class="entry-content"> |
170 | 170 | <?php |
171 | - $the_feature = apply_filters( 'the_content', $features ); |
|
172 | - ?> |
|
171 | + $the_feature = apply_filters( 'the_content', $features ); |
|
172 | + ?> |
|
173 | 173 | <?php echo wp_kses_post( $the_feature ); ?> |
174 | 174 | </div> |
175 | 175 | </div> |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | </div> |
178 | 178 | </section> |
179 | 179 | <?php |
180 | - } |
|
181 | - } |
|
180 | + } |
|
181 | + } |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | * @category vehicle |
190 | 190 | */ |
191 | 191 | function lsx_vehicle_accommodation() { |
192 | - global $lsx_archive; |
|
193 | - if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) { |
|
194 | - $args = array( |
|
195 | - 'from' => 'accommodation', |
|
196 | - 'to' => 'vehicle', |
|
197 | - 'column' => '3', |
|
198 | - 'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>', |
|
199 | - 'after' => '</section>', |
|
200 | - ); |
|
201 | - lsx_to_connected_panel_query( $args ); |
|
202 | - } |
|
192 | + global $lsx_archive; |
|
193 | + if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) { |
|
194 | + $args = array( |
|
195 | + 'from' => 'accommodation', |
|
196 | + 'to' => 'vehicle', |
|
197 | + 'column' => '3', |
|
198 | + 'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>', |
|
199 | + 'after' => '</section>', |
|
200 | + ); |
|
201 | + lsx_to_connected_panel_query( $args ); |
|
202 | + } |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -210,19 +210,19 @@ discard block |
||
210 | 210 | * @category vehicle |
211 | 211 | */ |
212 | 212 | function lsx_to_destination_vehicles() { |
213 | - global $lsx_archive; |
|
213 | + global $lsx_archive; |
|
214 | 214 | |
215 | - if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) { |
|
216 | - $args = array( |
|
217 | - 'from' => 'vehicle', |
|
218 | - 'to' => 'destination', |
|
219 | - 'column' => '3', |
|
220 | - 'before' => '<section id="vehicle" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">', |
|
221 | - 'after' => '</div></div></section>', |
|
222 | - ); |
|
215 | + if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) { |
|
216 | + $args = array( |
|
217 | + 'from' => 'vehicle', |
|
218 | + 'to' => 'destination', |
|
219 | + 'column' => '3', |
|
220 | + 'before' => '<section id="vehicle" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">', |
|
221 | + 'after' => '</div></div></section>', |
|
222 | + ); |
|
223 | 223 | |
224 | - lsx_to_connected_panel_query( $args ); |
|
225 | - } |
|
224 | + lsx_to_connected_panel_query( $args ); |
|
225 | + } |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | * @category vehicle |
234 | 234 | */ |
235 | 235 | function lsx_vehicle_tours() { |
236 | - global $lsx_archive; |
|
237 | - if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) { |
|
238 | - $args = array( |
|
239 | - 'from' => 'tour', |
|
240 | - 'to' => 'vehicle', |
|
241 | - 'column' => '3', |
|
242 | - 'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>', |
|
243 | - 'after' => '</section>', |
|
244 | - ); |
|
245 | - lsx_to_connected_panel_query( $args ); |
|
246 | - } |
|
236 | + global $lsx_archive; |
|
237 | + if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) { |
|
238 | + $args = array( |
|
239 | + 'from' => 'tour', |
|
240 | + 'to' => 'vehicle', |
|
241 | + 'column' => '3', |
|
242 | + 'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>', |
|
243 | + 'after' => '</section>', |
|
244 | + ); |
|
245 | + lsx_to_connected_panel_query( $args ); |
|
246 | + } |
|
247 | 247 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | $permalink = ''; |
13 | 13 | |
14 | 14 | if ( $has_single ) { |
15 | - $permalink = get_the_permalink(); |
|
15 | + $permalink = get_the_permalink(); |
|
16 | 16 | } elseif ( ! is_post_type_archive( 'vehicle' ) ) { |
17 | - $has_single = true; |
|
18 | - $permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name; |
|
17 | + $has_single = true; |
|
18 | + $permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name; |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | |
45 | 45 | <div class="lsx-to-widget-meta-data"> |
46 | 46 | <?php |
47 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
48 | - ?> |
|
47 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
48 | + ?> |
|
49 | 49 | <?php if ( false !== get_post_meta( get_the_ID(), 'vehicle_type', true ) ) { ?> |
50 | 50 | <div <?php echo 'class="' . esc_html( $meta_class ) . 'type"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Type', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( get_post_meta( get_the_ID(), 'vehicle_type', true ) ); ?></div> |
51 | 51 | <?php } ?> |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | <?php } ?> |
58 | 58 | </div> |
59 | 59 | <?php |
60 | - ob_start(); |
|
61 | - lsx_to_widget_entry_content_top(); |
|
62 | - the_excerpt(); |
|
63 | - lsx_to_widget_entry_content_bottom(); |
|
64 | - $excerpt = ob_get_clean(); |
|
60 | + ob_start(); |
|
61 | + lsx_to_widget_entry_content_top(); |
|
62 | + the_excerpt(); |
|
63 | + lsx_to_widget_entry_content_bottom(); |
|
64 | + $excerpt = ob_get_clean(); |
|
65 | 65 | |
66 | - if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
67 | - echo wp_kses_post( $excerpt ); |
|
68 | - } elseif ( $has_single ) { ?> |
|
66 | + if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
67 | + echo wp_kses_post( $excerpt ); |
|
68 | + } elseif ( $has_single ) { ?> |
|
69 | 69 | <p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'tour-operator' ); ?></a></p> |
70 | 70 | <?php |
71 | - } |
|
72 | - ?> |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | <?php lsx_widget_entry_content_bottom(); ?> |
74 | 74 | </div> |
75 | 75 | <?php lsx_widget_entry_bottom(); ?> |
@@ -53,4 +53,4 @@ |
||
53 | 53 | <?php get_sidebar(); ?> |
54 | 54 | |
55 | 55 | <?php |
56 | - get_footer(); |
|
56 | + get_footer(); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | global $lsx_archive, $lsx_to_archive, $post; |
10 | 10 | |
11 | 11 | if ( 1 !== $lsx_archive ) { |
12 | - $lsx_archive = false; |
|
12 | + $lsx_archive = false; |
|
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | <h3 class="lsx-to-archive-content-title"> |
30 | 30 | <a href="<?php the_permalink(); ?>" title="<?php esc_html_e( 'Read more', 'tour-operator' ); ?>"> |
31 | 31 | <?php |
32 | - the_title(); |
|
33 | - do_action( 'lsx_to_the_title_end', get_the_ID() ); |
|
34 | - ?> |
|
32 | + the_title(); |
|
33 | + do_action( 'lsx_to_the_title_end', get_the_ID() ); |
|
34 | + ?> |
|
35 | 35 | </a> |
36 | 36 | </h3> |
37 | 37 | <!-- .entry-header --> |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | <?php if ( lsx_to_has_enquiry_contact() ) : ?> |
84 | 84 | <div class="lsx-to-contact-widget"> |
85 | 85 | <?php |
86 | - if ( function_exists( 'lsx_to_has_team_member' ) && lsx_to_has_team_member() ) { |
|
87 | - lsx_to_team_member_panel( '<div class="lsx-to-contact">', '</div>' ); |
|
88 | - } else { |
|
89 | - lsx_to_enquiry_contact( '<div class="lsx-to-contact">', '</div>' ); |
|
90 | - } |
|
86 | + if ( function_exists( 'lsx_to_has_team_member' ) && lsx_to_has_team_member() ) { |
|
87 | + lsx_to_team_member_panel( '<div class="lsx-to-contact">', '</div>' ); |
|
88 | + } else { |
|
89 | + lsx_to_enquiry_contact( '<div class="lsx-to-contact">', '</div>' ); |
|
90 | + } |
|
91 | 91 | |
92 | - lsx_to_enquire_modal(); |
|
93 | - ?> |
|
92 | + lsx_to_enquire_modal(); |
|
93 | + ?> |
|
94 | 94 | </div> |
95 | 95 | <?php endif ?> |
96 | 96 | </div> |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | <?php } ?> |
122 | 122 | |
123 | 123 | <?php |
124 | - /** |
|
125 | - * Hooked |
|
126 | - * |
|
127 | - * - lsx_vehicle_metabox() - 10 |
|
128 | - */ |
|
129 | - lsx_entry_bottom(); |
|
130 | - ?> |
|
124 | + /** |
|
125 | + * Hooked |
|
126 | + * |
|
127 | + * - lsx_vehicle_metabox() - 10 |
|
128 | + */ |
|
129 | + lsx_entry_bottom(); |
|
130 | + ?> |
|
131 | 131 | |
132 | 132 | </article><!-- #post-## --> |
133 | 133 |
@@ -9,231 +9,231 @@ |
||
9 | 9 | * @copyright 2016 LightSpeedDevelopment |
10 | 10 | */ |
11 | 11 | if ( ! class_exists( 'LSX_TO_Vehicles' ) ) { |
12 | - /** |
|
13 | - * Main plugin class. |
|
14 | - * |
|
15 | - * @package LSX_TO_Vehicles |
|
16 | - * @author LightSpeed |
|
17 | - */ |
|
18 | - class LSX_TO_Vehicles { |
|
19 | - |
|
20 | - /** |
|
21 | - * The plugins id |
|
22 | - */ |
|
23 | - public $plugin_slug = 'to-vehicles'; |
|
24 | - |
|
25 | - /** |
|
26 | - * The post types the plugin registers |
|
27 | - */ |
|
28 | - public $post_types = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * The singular post types the plugin registers |
|
32 | - */ |
|
33 | - public $post_types_singular = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * An array of the post types slugs plugin registers |
|
37 | - */ |
|
38 | - public $post_type_slugs = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * The taxonomies the plugin registers |
|
42 | - */ |
|
43 | - public $taxonomies = false; |
|
44 | - |
|
45 | - /** |
|
46 | - * The taxonomies the plugin registers (plural) |
|
47 | - */ |
|
48 | - public $taxonomies_plural = false; |
|
49 | - |
|
50 | - /** |
|
51 | - * Constructor |
|
52 | - */ |
|
53 | - public function __construct() { |
|
54 | - //Set the variables |
|
55 | - $this->set_vars(); |
|
56 | - $this->lsx_to_search_integration(); |
|
57 | - |
|
58 | - // Make TO last plugin to load |
|
59 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
60 | - |
|
61 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
62 | - |
|
63 | - if ( false !== $this->post_types ) { |
|
64 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); |
|
65 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); |
|
66 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); |
|
67 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); |
|
68 | - } |
|
69 | - if ( false !== $this->taxonomies ) { |
|
70 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
71 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); |
|
72 | - } |
|
73 | - |
|
74 | - require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-admin.php' ); |
|
75 | - require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-frontend.php' ); |
|
76 | - require_once( LSX_TO_VEHICLES_PATH . '/includes/template-tags.php' ); |
|
77 | - |
|
78 | - // flush_rewrite_rules() |
|
79 | - register_activation_hook( LSX_TO_VEHICLES_CORE, array( $this, 'register_activation_hook' ) ); |
|
80 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * Include the post type for the search integration |
|
85 | - */ |
|
86 | - public function lsx_to_search_integration() { |
|
87 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
88 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Load the plugin text domain for translation. |
|
93 | - */ |
|
94 | - public function load_plugin_textdomain() { |
|
95 | - load_plugin_textdomain( 'to-vehicles', false, basename( LSX_TO_VEHICLES_PATH ) . '/languages' ); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Sets the plugins variables |
|
100 | - */ |
|
101 | - public function set_vars() { |
|
102 | - $this->post_types = array( |
|
103 | - 'vehicle' => __( 'Vehicles', 'to-vehicles' ), |
|
104 | - ); |
|
105 | - $this->post_types_singular = array( |
|
106 | - 'vehicle' => __( 'Vehicle', 'to-vehicles' ), |
|
107 | - ); |
|
108 | - $this->post_type_slugs = array_keys( $this->post_types ); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Adds our post types to an array via a filter |
|
113 | - */ |
|
114 | - public function plugin_path( $path, $post_type ) { |
|
115 | - if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { |
|
116 | - $path = LSX_TO_VEHICLES_PATH; |
|
117 | - } |
|
118 | - return $path; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Adds our post types to an array via a filter |
|
123 | - */ |
|
124 | - public function post_types_slugs_filter( $post_types ) { |
|
125 | - if ( is_array( $post_types ) ) { |
|
126 | - $post_types = array_merge( $post_types, $this->post_type_slugs ); |
|
127 | - } else { |
|
128 | - $post_types = $this->post_type_slugs; |
|
129 | - } |
|
130 | - return $post_types; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Adds our post types to an array via a filter |
|
135 | - */ |
|
136 | - public function post_types_filter( $post_types ) { |
|
137 | - if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
138 | - $post_types = array_merge( $post_types, $this->post_types ); |
|
139 | - } elseif ( is_array( $this->post_types ) ) { |
|
140 | - $post_types = $this->post_types; |
|
141 | - } |
|
142 | - return $post_types; |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Adds our post types to an array via a filter |
|
147 | - */ |
|
148 | - public function post_types_singular_filter( $post_types_singular ) { |
|
149 | - if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
150 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
151 | - } elseif ( is_array( $this->post_types_singular ) ) { |
|
152 | - $post_types_singular = $this->post_types_singular; |
|
153 | - } |
|
154 | - return $post_types_singular; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Adds our taxonomies to an array via a filter |
|
159 | - */ |
|
160 | - public function taxonomies_filter( $taxonomies ) { |
|
161 | - if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
162 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
163 | - } elseif ( is_array( $this->taxonomies ) ) { |
|
164 | - $taxonomies = $this->taxonomies; |
|
165 | - } |
|
166 | - return $taxonomies; |
|
167 | - } |
|
168 | - |
|
169 | - /** |
|
170 | - * Adds our taxonomies_plural to an array via a filter |
|
171 | - */ |
|
172 | - public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
173 | - if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
174 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
175 | - } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
176 | - $taxonomies_plural = $this->taxonomies_plural; |
|
177 | - } |
|
178 | - return $taxonomies_plural; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * Make TO last plugin to load. |
|
183 | - */ |
|
184 | - public function activated_plugin() { |
|
185 | - if ( get_option( 'active_plugins' ) === $plugins ) { |
|
186 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
187 | - $key = array_search( $search, $plugins ); |
|
188 | - |
|
189 | - if ( is_array( $search ) && count( $search ) ) { |
|
190 | - foreach ( $search as $key => $path ) { |
|
191 | - array_splice( $plugins, $key, 1 ); |
|
192 | - array_push( $plugins, $path ); |
|
193 | - update_option( 'active_plugins', $plugins ); |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * On plugin activation |
|
201 | - */ |
|
202 | - public function register_activation_hook() { |
|
203 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
204 | - set_transient( '_tour_operators_vehicles_flush_rewrite_rules', 1, 30 ); |
|
205 | - } |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * On plugin activation (check) |
|
210 | - */ |
|
211 | - public function register_activation_hook_check() { |
|
212 | - if ( ! get_transient( '_tour_operators_vehicles_flush_rewrite_rules' ) ) { |
|
213 | - return; |
|
214 | - } |
|
215 | - |
|
216 | - delete_transient( '_tour_operators_vehicles_flush_rewrite_rules' ); |
|
217 | - flush_rewrite_rules(); |
|
218 | - } |
|
219 | - |
|
220 | - /** |
|
221 | - * Enabled banners for the additional post types |
|
222 | - * |
|
223 | - * @package theme |
|
224 | - * @subpackage setup |
|
225 | - * @category banners |
|
226 | - * |
|
227 | - * @param $post_types array() |
|
228 | - * @return $post_types array() |
|
229 | - */ |
|
230 | - function theme_allowed_post_type_banners( $post_types ) { |
|
231 | - $post_types[] = 'summary'; |
|
232 | - $post_types[] = 'gallery'; |
|
233 | - $post_types[] = 'video'; |
|
234 | - return $post_types; |
|
235 | - } |
|
236 | - |
|
237 | - } |
|
238 | - new LSX_TO_Vehicles(); |
|
12 | + /** |
|
13 | + * Main plugin class. |
|
14 | + * |
|
15 | + * @package LSX_TO_Vehicles |
|
16 | + * @author LightSpeed |
|
17 | + */ |
|
18 | + class LSX_TO_Vehicles { |
|
19 | + |
|
20 | + /** |
|
21 | + * The plugins id |
|
22 | + */ |
|
23 | + public $plugin_slug = 'to-vehicles'; |
|
24 | + |
|
25 | + /** |
|
26 | + * The post types the plugin registers |
|
27 | + */ |
|
28 | + public $post_types = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * The singular post types the plugin registers |
|
32 | + */ |
|
33 | + public $post_types_singular = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * An array of the post types slugs plugin registers |
|
37 | + */ |
|
38 | + public $post_type_slugs = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * The taxonomies the plugin registers |
|
42 | + */ |
|
43 | + public $taxonomies = false; |
|
44 | + |
|
45 | + /** |
|
46 | + * The taxonomies the plugin registers (plural) |
|
47 | + */ |
|
48 | + public $taxonomies_plural = false; |
|
49 | + |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + */ |
|
53 | + public function __construct() { |
|
54 | + //Set the variables |
|
55 | + $this->set_vars(); |
|
56 | + $this->lsx_to_search_integration(); |
|
57 | + |
|
58 | + // Make TO last plugin to load |
|
59 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
60 | + |
|
61 | + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
62 | + |
|
63 | + if ( false !== $this->post_types ) { |
|
64 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); |
|
65 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); |
|
66 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); |
|
67 | + add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); |
|
68 | + } |
|
69 | + if ( false !== $this->taxonomies ) { |
|
70 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
71 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); |
|
72 | + } |
|
73 | + |
|
74 | + require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-admin.php' ); |
|
75 | + require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-frontend.php' ); |
|
76 | + require_once( LSX_TO_VEHICLES_PATH . '/includes/template-tags.php' ); |
|
77 | + |
|
78 | + // flush_rewrite_rules() |
|
79 | + register_activation_hook( LSX_TO_VEHICLES_CORE, array( $this, 'register_activation_hook' ) ); |
|
80 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * Include the post type for the search integration |
|
85 | + */ |
|
86 | + public function lsx_to_search_integration() { |
|
87 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
88 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Load the plugin text domain for translation. |
|
93 | + */ |
|
94 | + public function load_plugin_textdomain() { |
|
95 | + load_plugin_textdomain( 'to-vehicles', false, basename( LSX_TO_VEHICLES_PATH ) . '/languages' ); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Sets the plugins variables |
|
100 | + */ |
|
101 | + public function set_vars() { |
|
102 | + $this->post_types = array( |
|
103 | + 'vehicle' => __( 'Vehicles', 'to-vehicles' ), |
|
104 | + ); |
|
105 | + $this->post_types_singular = array( |
|
106 | + 'vehicle' => __( 'Vehicle', 'to-vehicles' ), |
|
107 | + ); |
|
108 | + $this->post_type_slugs = array_keys( $this->post_types ); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Adds our post types to an array via a filter |
|
113 | + */ |
|
114 | + public function plugin_path( $path, $post_type ) { |
|
115 | + if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { |
|
116 | + $path = LSX_TO_VEHICLES_PATH; |
|
117 | + } |
|
118 | + return $path; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Adds our post types to an array via a filter |
|
123 | + */ |
|
124 | + public function post_types_slugs_filter( $post_types ) { |
|
125 | + if ( is_array( $post_types ) ) { |
|
126 | + $post_types = array_merge( $post_types, $this->post_type_slugs ); |
|
127 | + } else { |
|
128 | + $post_types = $this->post_type_slugs; |
|
129 | + } |
|
130 | + return $post_types; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Adds our post types to an array via a filter |
|
135 | + */ |
|
136 | + public function post_types_filter( $post_types ) { |
|
137 | + if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
138 | + $post_types = array_merge( $post_types, $this->post_types ); |
|
139 | + } elseif ( is_array( $this->post_types ) ) { |
|
140 | + $post_types = $this->post_types; |
|
141 | + } |
|
142 | + return $post_types; |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Adds our post types to an array via a filter |
|
147 | + */ |
|
148 | + public function post_types_singular_filter( $post_types_singular ) { |
|
149 | + if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
150 | + $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
151 | + } elseif ( is_array( $this->post_types_singular ) ) { |
|
152 | + $post_types_singular = $this->post_types_singular; |
|
153 | + } |
|
154 | + return $post_types_singular; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Adds our taxonomies to an array via a filter |
|
159 | + */ |
|
160 | + public function taxonomies_filter( $taxonomies ) { |
|
161 | + if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
162 | + $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
163 | + } elseif ( is_array( $this->taxonomies ) ) { |
|
164 | + $taxonomies = $this->taxonomies; |
|
165 | + } |
|
166 | + return $taxonomies; |
|
167 | + } |
|
168 | + |
|
169 | + /** |
|
170 | + * Adds our taxonomies_plural to an array via a filter |
|
171 | + */ |
|
172 | + public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
173 | + if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
174 | + $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
175 | + } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
176 | + $taxonomies_plural = $this->taxonomies_plural; |
|
177 | + } |
|
178 | + return $taxonomies_plural; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * Make TO last plugin to load. |
|
183 | + */ |
|
184 | + public function activated_plugin() { |
|
185 | + if ( get_option( 'active_plugins' ) === $plugins ) { |
|
186 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
187 | + $key = array_search( $search, $plugins ); |
|
188 | + |
|
189 | + if ( is_array( $search ) && count( $search ) ) { |
|
190 | + foreach ( $search as $key => $path ) { |
|
191 | + array_splice( $plugins, $key, 1 ); |
|
192 | + array_push( $plugins, $path ); |
|
193 | + update_option( 'active_plugins', $plugins ); |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * On plugin activation |
|
201 | + */ |
|
202 | + public function register_activation_hook() { |
|
203 | + if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
204 | + set_transient( '_tour_operators_vehicles_flush_rewrite_rules', 1, 30 ); |
|
205 | + } |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * On plugin activation (check) |
|
210 | + */ |
|
211 | + public function register_activation_hook_check() { |
|
212 | + if ( ! get_transient( '_tour_operators_vehicles_flush_rewrite_rules' ) ) { |
|
213 | + return; |
|
214 | + } |
|
215 | + |
|
216 | + delete_transient( '_tour_operators_vehicles_flush_rewrite_rules' ); |
|
217 | + flush_rewrite_rules(); |
|
218 | + } |
|
219 | + |
|
220 | + /** |
|
221 | + * Enabled banners for the additional post types |
|
222 | + * |
|
223 | + * @package theme |
|
224 | + * @subpackage setup |
|
225 | + * @category banners |
|
226 | + * |
|
227 | + * @param $post_types array() |
|
228 | + * @return $post_types array() |
|
229 | + */ |
|
230 | + function theme_allowed_post_type_banners( $post_types ) { |
|
231 | + $post_types[] = 'summary'; |
|
232 | + $post_types[] = 'gallery'; |
|
233 | + $post_types[] = 'video'; |
|
234 | + return $post_types; |
|
235 | + } |
|
236 | + |
|
237 | + } |
|
238 | + new LSX_TO_Vehicles(); |
|
239 | 239 | } |
@@ -10,173 +10,173 @@ |
||
10 | 10 | |
11 | 11 | class LSX_TO_Template_Redirects { |
12 | 12 | |
13 | - /** |
|
14 | - * Plugin Path |
|
15 | - */ |
|
16 | - public $plugin_path = false; |
|
13 | + /** |
|
14 | + * Plugin Path |
|
15 | + */ |
|
16 | + public $plugin_path = false; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Post Types |
|
20 | - */ |
|
21 | - public $post_types = false; |
|
18 | + /** |
|
19 | + * Post Types |
|
20 | + */ |
|
21 | + public $post_types = false; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Taxonomies |
|
25 | - */ |
|
26 | - public $taxonomies = false; |
|
23 | + /** |
|
24 | + * Taxonomies |
|
25 | + */ |
|
26 | + public $taxonomies = false; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Initialize the plugin by setting localization, filters, and administration functions. |
|
30 | - * |
|
31 | - * @param array $post_types an array of the post types to redirect. |
|
32 | - * @param array $taxonomies an array of the taxonomies to redirect. |
|
33 | - */ |
|
34 | - public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) { |
|
35 | - if ( false !== $plugin_path ) { |
|
36 | - $this->plugin_path = $plugin_path; |
|
28 | + /** |
|
29 | + * Initialize the plugin by setting localization, filters, and administration functions. |
|
30 | + * |
|
31 | + * @param array $post_types an array of the post types to redirect. |
|
32 | + * @param array $taxonomies an array of the taxonomies to redirect. |
|
33 | + */ |
|
34 | + public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) { |
|
35 | + if ( false !== $plugin_path ) { |
|
36 | + $this->plugin_path = $plugin_path; |
|
37 | 37 | |
38 | - add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 ); |
|
39 | - add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 ); |
|
38 | + add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 ); |
|
39 | + add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 ); |
|
40 | 40 | |
41 | - if ( false !== $post_types ) { |
|
42 | - $this->post_types = $post_types; |
|
43 | - add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 ); |
|
44 | - add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 ); |
|
45 | - add_filter( 'template_include', array( $this, 'search_template_include' ), 99 ); |
|
46 | - } |
|
47 | - if ( false !== $taxonomies ) { |
|
48 | - $this->taxonomies = $taxonomies; |
|
49 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
41 | + if ( false !== $post_types ) { |
|
42 | + $this->post_types = $post_types; |
|
43 | + add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 ); |
|
44 | + add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 ); |
|
45 | + add_filter( 'template_include', array( $this, 'search_template_include' ), 99 ); |
|
46 | + } |
|
47 | + if ( false !== $taxonomies ) { |
|
48 | + $this->taxonomies = $taxonomies; |
|
49 | + add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Redirect wordpress to the archive template located in the plugin |
|
56 | - * |
|
57 | - * @param $template |
|
58 | - * @return $template |
|
59 | - */ |
|
60 | - public function post_type_archive_template_include( $template ) { |
|
61 | - if ( is_main_query() && is_post_type_archive( $this->post_types ) ) { |
|
62 | - $current_post_type = get_post_type(); |
|
63 | - if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) ) && file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) { |
|
64 | - $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php'; |
|
65 | - } |
|
66 | - } |
|
67 | - return $template; |
|
68 | - } |
|
69 | - /** |
|
70 | - * Redirect wordpress to the single template located in the plugin |
|
71 | - * |
|
72 | - * @param $template |
|
73 | - * |
|
74 | - * @return $template |
|
75 | - */ |
|
76 | - public function post_type_single_template_include( $template ) { |
|
77 | - if ( is_main_query() && is_singular( $this->post_types ) ) { |
|
78 | - $current_post_type = get_post_type(); |
|
79 | - if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) ) && file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) { |
|
80 | - $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php'; |
|
81 | - } |
|
82 | - } |
|
83 | - return $template; |
|
84 | - } |
|
85 | - /** |
|
86 | - * Redirect wordpress to the taxonomy located in the plugin |
|
87 | - * |
|
88 | - * @param $template |
|
89 | - * |
|
90 | - * @return $template |
|
91 | - */ |
|
92 | - public function taxonomy_template_include( $template ) { |
|
54 | + /** |
|
55 | + * Redirect wordpress to the archive template located in the plugin |
|
56 | + * |
|
57 | + * @param $template |
|
58 | + * @return $template |
|
59 | + */ |
|
60 | + public function post_type_archive_template_include( $template ) { |
|
61 | + if ( is_main_query() && is_post_type_archive( $this->post_types ) ) { |
|
62 | + $current_post_type = get_post_type(); |
|
63 | + if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) ) && file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) { |
|
64 | + $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php'; |
|
65 | + } |
|
66 | + } |
|
67 | + return $template; |
|
68 | + } |
|
69 | + /** |
|
70 | + * Redirect wordpress to the single template located in the plugin |
|
71 | + * |
|
72 | + * @param $template |
|
73 | + * |
|
74 | + * @return $template |
|
75 | + */ |
|
76 | + public function post_type_single_template_include( $template ) { |
|
77 | + if ( is_main_query() && is_singular( $this->post_types ) ) { |
|
78 | + $current_post_type = get_post_type(); |
|
79 | + if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) ) && file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) { |
|
80 | + $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php'; |
|
81 | + } |
|
82 | + } |
|
83 | + return $template; |
|
84 | + } |
|
85 | + /** |
|
86 | + * Redirect wordpress to the taxonomy located in the plugin |
|
87 | + * |
|
88 | + * @param $template |
|
89 | + * |
|
90 | + * @return $template |
|
91 | + */ |
|
92 | + public function taxonomy_template_include( $template ) { |
|
93 | 93 | |
94 | - if ( is_main_query() && is_tax( $this->taxonomies ) ) { |
|
95 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
96 | - if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
97 | - $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
98 | - } |
|
99 | - } |
|
100 | - return $template; |
|
101 | - } |
|
94 | + if ( is_main_query() && is_tax( $this->taxonomies ) ) { |
|
95 | + $current_taxonomy = get_query_var( 'taxonomy' ); |
|
96 | + if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
97 | + $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
98 | + } |
|
99 | + } |
|
100 | + return $template; |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Redirect wordpress to the search template located in the plugin |
|
105 | - * |
|
106 | - * @param $template |
|
107 | - * |
|
108 | - * @return $template |
|
109 | - */ |
|
110 | - public function search_template_include( $template ) { |
|
111 | - if ( is_main_query() && is_search() ) { |
|
112 | - if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) { |
|
113 | - $template = $this->plugin_path . 'templates/search.php'; |
|
114 | - } |
|
115 | - } |
|
116 | - return $template; |
|
117 | - } |
|
103 | + /** |
|
104 | + * Redirect wordpress to the search template located in the plugin |
|
105 | + * |
|
106 | + * @param $template |
|
107 | + * |
|
108 | + * @return $template |
|
109 | + */ |
|
110 | + public function search_template_include( $template ) { |
|
111 | + if ( is_main_query() && is_search() ) { |
|
112 | + if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) { |
|
113 | + $template = $this->plugin_path . 'templates/search.php'; |
|
114 | + } |
|
115 | + } |
|
116 | + return $template; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Redirect wordpress to the single template located in the plugin |
|
121 | - * |
|
122 | - * @param $template |
|
123 | - * |
|
124 | - * @return $template |
|
125 | - */ |
|
126 | - public function content_part( $slug, $name = null ) { |
|
127 | - $template = array(); |
|
128 | - $name = (string) $name; |
|
129 | - if ( '' !== $name ) { |
|
130 | - $template = "{$slug}-{$name}.php"; |
|
131 | - } else { |
|
132 | - $template = "{$slug}.php"; |
|
133 | - } |
|
134 | - $original_name = $template; |
|
135 | - $path = apply_filters( 'lsx_to_content_path', '', get_post_type() ); |
|
119 | + /** |
|
120 | + * Redirect wordpress to the single template located in the plugin |
|
121 | + * |
|
122 | + * @param $template |
|
123 | + * |
|
124 | + * @return $template |
|
125 | + */ |
|
126 | + public function content_part( $slug, $name = null ) { |
|
127 | + $template = array(); |
|
128 | + $name = (string) $name; |
|
129 | + if ( '' !== $name ) { |
|
130 | + $template = "{$slug}-{$name}.php"; |
|
131 | + } else { |
|
132 | + $template = "{$slug}.php"; |
|
133 | + } |
|
134 | + $original_name = $template; |
|
135 | + $path = apply_filters( 'lsx_to_content_path', '', get_post_type() ); |
|
136 | 136 | |
137 | - if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) { |
|
138 | - $template = $path . 'templates/' . $template; |
|
139 | - } elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) { |
|
140 | - $template = get_stylesheet_directory() . '/' . $template; |
|
141 | - } else { |
|
142 | - $template = false; |
|
143 | - } |
|
144 | - if ( false !== $template ) { |
|
145 | - load_template( $template, false ); |
|
146 | - } else { |
|
147 | - echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' ); |
|
148 | - } |
|
149 | - } |
|
137 | + if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) { |
|
138 | + $template = $path . 'templates/' . $template; |
|
139 | + } elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) { |
|
140 | + $template = get_stylesheet_directory() . '/' . $template; |
|
141 | + } else { |
|
142 | + $template = false; |
|
143 | + } |
|
144 | + if ( false !== $template ) { |
|
145 | + load_template( $template, false ); |
|
146 | + } else { |
|
147 | + echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' ); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Redirect wordpress to the widget template located in the plugin |
|
153 | - * |
|
154 | - * @param $path |
|
155 | - * @param $post_type |
|
156 | - * |
|
157 | - * @return $path |
|
158 | - */ |
|
159 | - public function widget_path( $path, $slug ) { |
|
160 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) |
|
161 | - || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { |
|
162 | - $path = $this->plugin_path; |
|
163 | - } |
|
164 | - return $path; |
|
165 | - } |
|
151 | + /** |
|
152 | + * Redirect wordpress to the widget template located in the plugin |
|
153 | + * |
|
154 | + * @param $path |
|
155 | + * @param $post_type |
|
156 | + * |
|
157 | + * @return $path |
|
158 | + */ |
|
159 | + public function widget_path( $path, $slug ) { |
|
160 | + if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) |
|
161 | + || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { |
|
162 | + $path = $this->plugin_path; |
|
163 | + } |
|
164 | + return $path; |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * Redirect wordpress to the single template located in the plugin |
|
169 | - * |
|
170 | - * @param $path |
|
171 | - * @param $post_type |
|
172 | - * |
|
173 | - * @return $path |
|
174 | - */ |
|
175 | - public function content_path( $path, $slug ) { |
|
176 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) |
|
177 | - || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { |
|
178 | - $path = $this->plugin_path; |
|
179 | - } |
|
180 | - return $path; |
|
181 | - } |
|
167 | + /** |
|
168 | + * Redirect wordpress to the single template located in the plugin |
|
169 | + * |
|
170 | + * @param $path |
|
171 | + * @param $post_type |
|
172 | + * |
|
173 | + * @return $path |
|
174 | + */ |
|
175 | + public function content_path( $path, $slug ) { |
|
176 | + if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) |
|
177 | + || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { |
|
178 | + $path = $this->plugin_path; |
|
179 | + } |
|
180 | + return $path; |
|
181 | + } |
|
182 | 182 | } |
@@ -18,135 +18,135 @@ |
||
18 | 18 | |
19 | 19 | class LSX_TO_Vehicles_Frontend extends LSX_TO_Vehicles { |
20 | 20 | |
21 | - /** |
|
22 | - * Holds the $page_links array while its being built on the single team page. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - public $page_links = false; |
|
27 | - |
|
28 | - /** |
|
29 | - * Holds the array of options. |
|
30 | - * |
|
31 | - * @var array |
|
32 | - */ |
|
33 | - public $options = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * Constructor |
|
37 | - */ |
|
38 | - public function __construct() { |
|
39 | - $this->set_vars(); |
|
40 | - |
|
41 | - add_action( 'wp_head', array( $this, 'wp_head' ), 20, 1 ); |
|
42 | - |
|
43 | - //add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
|
44 | - //add_action( 'init', array( $this, 'init' ) ); |
|
45 | - |
|
46 | - if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
|
47 | - require_once( LSX_TO_VEHICLES_PATH . 'classes/class-lsx-to-template-redirects.php' ); |
|
48 | - } |
|
49 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_VEHICLES_PATH, array_keys( $this->post_types ) ); |
|
50 | - add_action( 'lsx_vehicle_content', array( $this->redirects, 'content_part' ), 10, 2 ); |
|
51 | - |
|
52 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
|
53 | - |
|
54 | - //add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
|
55 | - //add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
|
56 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
|
57 | - |
|
58 | - add_action( 'lsx_banner_allowed_post_types', array( $this, 'theme_allowed_post_type_banners' ) ); |
|
59 | - } |
|
60 | - |
|
61 | - function wp_head() { |
|
62 | - if ( is_singular( 'vehicle' ) ) { |
|
63 | - remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Adds the template tags to the bottom of the single review |
|
69 | - */ |
|
70 | - public function single_content_bottom() { |
|
71 | - if ( is_singular( 'vehicle' ) ) { |
|
72 | - // lsx_to_review_accommodation(); |
|
73 | - |
|
74 | - // lsx_to_review_tour(); |
|
75 | - |
|
76 | - // lsx_to_review_destination(); |
|
77 | - |
|
78 | - lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
79 | - |
|
80 | - if ( function_exists( 'lsx_to_videos' ) ) { |
|
81 | - lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
82 | - } elseif ( class_exists( 'Envira_Videos' ) ) { |
|
83 | - lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
84 | - } //lsx_to_review_posts(); |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Adds our navigation links to the team single post |
|
90 | - * |
|
91 | - * @param $page_links array |
|
92 | - * @return $page_links array |
|
93 | - */ |
|
94 | - public function page_links( $page_links ) { |
|
95 | - if ( is_singular( 'vehicle' ) ) { |
|
96 | - $this->page_links = $page_links; |
|
97 | - $this->get_gallery_link(); |
|
98 | - $this->get_videos_link(); |
|
99 | - |
|
100 | - $page_links = $this->page_links; |
|
101 | - } |
|
102 | - |
|
103 | - return $page_links; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Tests for the Gallery and returns a link for the section |
|
108 | - */ |
|
109 | - public function get_gallery_link() { |
|
110 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
|
111 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
|
112 | - |
|
113 | - if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
|
114 | - if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
|
115 | - // Envira Gallery. |
|
116 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
117 | - return; |
|
118 | - } else { |
|
119 | - if ( function_exists( 'envira_dynamic' ) ) { |
|
120 | - // Envira Gallery - Dynamic. |
|
121 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
122 | - return; |
|
123 | - } else { |
|
124 | - // WordPress Gallery. |
|
125 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
126 | - return; |
|
127 | - } |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Tests for the Videos and returns a link for the section |
|
134 | - */ |
|
135 | - public function get_videos_link() { |
|
136 | - $videos_id = false; |
|
137 | - |
|
138 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
139 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
|
140 | - } |
|
141 | - |
|
142 | - if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
|
143 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
|
144 | - } |
|
145 | - |
|
146 | - if ( ! empty( $videos_id ) ) { |
|
147 | - $this->page_links['videos'] = esc_html__( 'Videos', 'to-vehicles' ); |
|
148 | - } |
|
149 | - } |
|
21 | + /** |
|
22 | + * Holds the $page_links array while its being built on the single team page. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + public $page_links = false; |
|
27 | + |
|
28 | + /** |
|
29 | + * Holds the array of options. |
|
30 | + * |
|
31 | + * @var array |
|
32 | + */ |
|
33 | + public $options = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + */ |
|
38 | + public function __construct() { |
|
39 | + $this->set_vars(); |
|
40 | + |
|
41 | + add_action( 'wp_head', array( $this, 'wp_head' ), 20, 1 ); |
|
42 | + |
|
43 | + //add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
|
44 | + //add_action( 'init', array( $this, 'init' ) ); |
|
45 | + |
|
46 | + if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
|
47 | + require_once( LSX_TO_VEHICLES_PATH . 'classes/class-lsx-to-template-redirects.php' ); |
|
48 | + } |
|
49 | + $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_VEHICLES_PATH, array_keys( $this->post_types ) ); |
|
50 | + add_action( 'lsx_vehicle_content', array( $this->redirects, 'content_part' ), 10, 2 ); |
|
51 | + |
|
52 | + add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
|
53 | + |
|
54 | + //add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
|
55 | + //add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
|
56 | + add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
|
57 | + |
|
58 | + add_action( 'lsx_banner_allowed_post_types', array( $this, 'theme_allowed_post_type_banners' ) ); |
|
59 | + } |
|
60 | + |
|
61 | + function wp_head() { |
|
62 | + if ( is_singular( 'vehicle' ) ) { |
|
63 | + remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Adds the template tags to the bottom of the single review |
|
69 | + */ |
|
70 | + public function single_content_bottom() { |
|
71 | + if ( is_singular( 'vehicle' ) ) { |
|
72 | + // lsx_to_review_accommodation(); |
|
73 | + |
|
74 | + // lsx_to_review_tour(); |
|
75 | + |
|
76 | + // lsx_to_review_destination(); |
|
77 | + |
|
78 | + lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
79 | + |
|
80 | + if ( function_exists( 'lsx_to_videos' ) ) { |
|
81 | + lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
82 | + } elseif ( class_exists( 'Envira_Videos' ) ) { |
|
83 | + lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
84 | + } //lsx_to_review_posts(); |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Adds our navigation links to the team single post |
|
90 | + * |
|
91 | + * @param $page_links array |
|
92 | + * @return $page_links array |
|
93 | + */ |
|
94 | + public function page_links( $page_links ) { |
|
95 | + if ( is_singular( 'vehicle' ) ) { |
|
96 | + $this->page_links = $page_links; |
|
97 | + $this->get_gallery_link(); |
|
98 | + $this->get_videos_link(); |
|
99 | + |
|
100 | + $page_links = $this->page_links; |
|
101 | + } |
|
102 | + |
|
103 | + return $page_links; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Tests for the Gallery and returns a link for the section |
|
108 | + */ |
|
109 | + public function get_gallery_link() { |
|
110 | + $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
|
111 | + $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
|
112 | + |
|
113 | + if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
|
114 | + if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
|
115 | + // Envira Gallery. |
|
116 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
117 | + return; |
|
118 | + } else { |
|
119 | + if ( function_exists( 'envira_dynamic' ) ) { |
|
120 | + // Envira Gallery - Dynamic. |
|
121 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
122 | + return; |
|
123 | + } else { |
|
124 | + // WordPress Gallery. |
|
125 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' ); |
|
126 | + return; |
|
127 | + } |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Tests for the Videos and returns a link for the section |
|
134 | + */ |
|
135 | + public function get_videos_link() { |
|
136 | + $videos_id = false; |
|
137 | + |
|
138 | + if ( class_exists( 'Envira_Videos' ) ) { |
|
139 | + $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
|
140 | + } |
|
141 | + |
|
142 | + if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
|
143 | + $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
|
144 | + } |
|
145 | + |
|
146 | + if ( ! empty( $videos_id ) ) { |
|
147 | + $this->page_links['videos'] = esc_html__( 'Videos', 'to-vehicles' ); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | new LSX_TO_Vehicles_Frontend(); |
@@ -18,447 +18,447 @@ |
||
18 | 18 | |
19 | 19 | class LSX_TO_Vehicles_Admin extends LSX_TO_Vehicles { |
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - */ |
|
24 | - public function __construct() { |
|
25 | - add_action( 'init', array( $this, 'register_post_types' ) ); |
|
26 | - add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + */ |
|
24 | + public function __construct() { |
|
25 | + add_action( 'init', array( $this, 'register_post_types' ) ); |
|
26 | + add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
27 | 27 | |
28 | - //add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
29 | - //add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
28 | + //add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
29 | + //add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
30 | 30 | |
31 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
33 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
34 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | - } |
|
31 | + add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | + add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
33 | + add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
34 | + add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | + add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | + add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Register the activity post type config |
|
41 | - * |
|
42 | - * @param $objects |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function post_type_config( $objects ) { |
|
39 | + /** |
|
40 | + * Register the activity post type config |
|
41 | + * |
|
42 | + * @param $objects |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function post_type_config( $objects ) { |
|
46 | 46 | |
47 | - foreach ( $this->post_types as $key => $label ) { |
|
48 | - if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
49 | - $objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
50 | - } |
|
51 | - } |
|
47 | + foreach ( $this->post_types as $key => $label ) { |
|
48 | + if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
49 | + $objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - return $objects; |
|
54 | - } |
|
53 | + return $objects; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Register the activity metabox config |
|
58 | - * |
|
59 | - * @param $meta_boxes |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - public function meta_box_config( $meta_boxes ) { |
|
63 | - foreach ( $this->post_types as $key => $label ) { |
|
64 | - if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
65 | - $meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
66 | - } |
|
67 | - } |
|
68 | - return $meta_boxes; |
|
69 | - } |
|
56 | + /** |
|
57 | + * Register the activity metabox config |
|
58 | + * |
|
59 | + * @param $meta_boxes |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + public function meta_box_config( $meta_boxes ) { |
|
63 | + foreach ( $this->post_types as $key => $label ) { |
|
64 | + if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
65 | + $meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
66 | + } |
|
67 | + } |
|
68 | + return $meta_boxes; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Register the landing pages post type. |
|
73 | - */ |
|
74 | - public function register_post_types() { |
|
71 | + /** |
|
72 | + * Register the landing pages post type. |
|
73 | + */ |
|
74 | + public function register_post_types() { |
|
75 | 75 | |
76 | - $labels = array( |
|
77 | - 'name' => _x( 'Vehicles', 'to-vehicles' ), |
|
78 | - 'singular_name' => _x( 'Vehicle', 'to-vehicles' ), |
|
79 | - 'add_new' => _x( 'Add New', 'to-vehicles' ), |
|
80 | - 'add_new_item' => _x( 'Add New Vehicle', 'to-vehicles' ), |
|
81 | - 'edit_item' => _x( 'Edit Vehicle', 'to-vehicles' ), |
|
82 | - 'new_item' => _x( 'New Vehicle', 'to-vehicles' ), |
|
83 | - 'all_items' => _x( 'Vehicles', 'to-vehicles' ), |
|
84 | - 'view_item' => _x( 'View Vehicle', 'to-vehicles' ), |
|
85 | - 'search_items' => _x( 'Search Vehicles', 'to-vehicles' ), |
|
86 | - 'not_found' => _x( 'No vehicles found', 'to-vehicles' ), |
|
87 | - 'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ), |
|
88 | - 'parent_item_colon' => '', |
|
89 | - 'menu_name' => _x( 'Vehicles', 'to-vehicles' ), |
|
90 | - ); |
|
76 | + $labels = array( |
|
77 | + 'name' => _x( 'Vehicles', 'to-vehicles' ), |
|
78 | + 'singular_name' => _x( 'Vehicle', 'to-vehicles' ), |
|
79 | + 'add_new' => _x( 'Add New', 'to-vehicles' ), |
|
80 | + 'add_new_item' => _x( 'Add New Vehicle', 'to-vehicles' ), |
|
81 | + 'edit_item' => _x( 'Edit Vehicle', 'to-vehicles' ), |
|
82 | + 'new_item' => _x( 'New Vehicle', 'to-vehicles' ), |
|
83 | + 'all_items' => _x( 'Vehicles', 'to-vehicles' ), |
|
84 | + 'view_item' => _x( 'View Vehicle', 'to-vehicles' ), |
|
85 | + 'search_items' => _x( 'Search Vehicles', 'to-vehicles' ), |
|
86 | + 'not_found' => _x( 'No vehicles found', 'to-vehicles' ), |
|
87 | + 'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ), |
|
88 | + 'parent_item_colon' => '', |
|
89 | + 'menu_name' => _x( 'Vehicles', 'to-vehicles' ), |
|
90 | + ); |
|
91 | 91 | |
92 | - $args = array( |
|
93 | - 'menu_icon' => 'dashicons-performance', |
|
94 | - 'labels' => $labels, |
|
95 | - 'public' => true, |
|
96 | - 'publicly_queryable' => true, |
|
97 | - 'show_ui' => true, |
|
98 | - 'show_in_menu' => 'tour-operator', |
|
99 | - 'menu_position' => 80, |
|
100 | - 'query_var' => true, |
|
101 | - 'rewrite' => array( |
|
102 | - 'slug' => 'vehicle', |
|
103 | - ), |
|
104 | - 'capability_type' => 'post', |
|
105 | - 'has_archive' => 'vehicles', |
|
106 | - 'hierarchical' => true, |
|
107 | - 'show_in_rest' => true, |
|
108 | - 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ), |
|
109 | - ); |
|
92 | + $args = array( |
|
93 | + 'menu_icon' => 'dashicons-performance', |
|
94 | + 'labels' => $labels, |
|
95 | + 'public' => true, |
|
96 | + 'publicly_queryable' => true, |
|
97 | + 'show_ui' => true, |
|
98 | + 'show_in_menu' => 'tour-operator', |
|
99 | + 'menu_position' => 80, |
|
100 | + 'query_var' => true, |
|
101 | + 'rewrite' => array( |
|
102 | + 'slug' => 'vehicle', |
|
103 | + ), |
|
104 | + 'capability_type' => 'post', |
|
105 | + 'has_archive' => 'vehicles', |
|
106 | + 'hierarchical' => true, |
|
107 | + 'show_in_rest' => true, |
|
108 | + 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ), |
|
109 | + ); |
|
110 | 110 | |
111 | - register_post_type( 'vehicle', $args ); |
|
111 | + register_post_type( 'vehicle', $args ); |
|
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - function register_metaboxes( array $meta_boxes ) { |
|
115 | + function register_metaboxes( array $meta_boxes ) { |
|
116 | 116 | |
117 | - $fields[] = array( |
|
118 | - 'id' => 'title', |
|
119 | - 'name' => 'General', |
|
120 | - 'type' => 'title', |
|
121 | - ); |
|
122 | - $fields[] = array( |
|
123 | - 'id' => 'featured', |
|
124 | - 'name' => 'Featured', |
|
125 | - 'type' => 'checkbox', |
|
126 | - ); |
|
127 | - if ( ! class_exists( 'LSX_Banners' ) ) { |
|
128 | - $fields[] = array( |
|
129 | - 'id' => 'tagline', |
|
130 | - 'name' => 'Tagline', |
|
131 | - 'type' => 'text', |
|
132 | - ); |
|
133 | - } |
|
134 | - $fields[] = array( |
|
135 | - 'id' => 'code', |
|
136 | - 'name' => 'Code', |
|
137 | - 'type' => 'text', |
|
138 | - ); |
|
139 | - $fields[] = array( |
|
140 | - 'id' => 'gearbox', |
|
141 | - 'name' => 'Gearbox Type', |
|
142 | - 'type' => 'radio', |
|
143 | - 'options' => array( |
|
144 | - 'Automatic' => 'Automatic', |
|
145 | - 'Manual' => 'Manual', |
|
146 | - ), |
|
147 | - ); |
|
148 | - $fields[] = array( |
|
149 | - 'id' => 'gears', |
|
150 | - 'name' => 'Gears', |
|
151 | - 'type' => 'radio', |
|
152 | - 'options' => array( |
|
153 | - '4', |
|
154 | - '5', |
|
155 | - '6', |
|
156 | - '7', |
|
157 | - ), |
|
158 | - ); |
|
159 | - $fields[] = array( |
|
160 | - 'id' => 'vehicle_type', |
|
161 | - 'name' => 'Vehicle Type', |
|
162 | - 'type' => 'text', |
|
163 | - ); |
|
164 | - $fields[] = array( |
|
165 | - 'id' => 'price', |
|
166 | - 'name' => 'Price Guide', |
|
167 | - 'type' => 'text', |
|
168 | - ); |
|
169 | - $fields[] = array( |
|
170 | - 'id' => 'engine_type', |
|
171 | - 'name' => 'Engine Type', |
|
172 | - 'type' => 'radio', |
|
173 | - 'options' => array( |
|
174 | - 'Diesel' => 'Diesel', |
|
175 | - 'Petrol' => 'Petrol', |
|
176 | - ), |
|
177 | - ); |
|
178 | - $fields[] = array( |
|
179 | - 'id' => 'engine_size', |
|
180 | - 'name' => 'Engine Size', |
|
181 | - 'type' => 'text', |
|
182 | - ); |
|
183 | - $fields[] = array( |
|
184 | - 'id' => 'seating', |
|
185 | - 'name' => 'Seats', |
|
186 | - 'type' => 'text', |
|
187 | - ); |
|
188 | - $fields[] = array( |
|
189 | - 'id' => 'features', |
|
190 | - 'name' => 'Features', |
|
191 | - 'type' => 'wysiwyg', |
|
192 | - 'options' => array( |
|
193 | - 'editor_height' => '100', |
|
194 | - ), |
|
195 | - ); |
|
196 | - $fields[] = array( |
|
197 | - 'id' => 'gallery_title', |
|
198 | - 'name' => 'Gallery', |
|
199 | - 'type' => 'title', |
|
200 | - ); |
|
117 | + $fields[] = array( |
|
118 | + 'id' => 'title', |
|
119 | + 'name' => 'General', |
|
120 | + 'type' => 'title', |
|
121 | + ); |
|
122 | + $fields[] = array( |
|
123 | + 'id' => 'featured', |
|
124 | + 'name' => 'Featured', |
|
125 | + 'type' => 'checkbox', |
|
126 | + ); |
|
127 | + if ( ! class_exists( 'LSX_Banners' ) ) { |
|
128 | + $fields[] = array( |
|
129 | + 'id' => 'tagline', |
|
130 | + 'name' => 'Tagline', |
|
131 | + 'type' => 'text', |
|
132 | + ); |
|
133 | + } |
|
134 | + $fields[] = array( |
|
135 | + 'id' => 'code', |
|
136 | + 'name' => 'Code', |
|
137 | + 'type' => 'text', |
|
138 | + ); |
|
139 | + $fields[] = array( |
|
140 | + 'id' => 'gearbox', |
|
141 | + 'name' => 'Gearbox Type', |
|
142 | + 'type' => 'radio', |
|
143 | + 'options' => array( |
|
144 | + 'Automatic' => 'Automatic', |
|
145 | + 'Manual' => 'Manual', |
|
146 | + ), |
|
147 | + ); |
|
148 | + $fields[] = array( |
|
149 | + 'id' => 'gears', |
|
150 | + 'name' => 'Gears', |
|
151 | + 'type' => 'radio', |
|
152 | + 'options' => array( |
|
153 | + '4', |
|
154 | + '5', |
|
155 | + '6', |
|
156 | + '7', |
|
157 | + ), |
|
158 | + ); |
|
159 | + $fields[] = array( |
|
160 | + 'id' => 'vehicle_type', |
|
161 | + 'name' => 'Vehicle Type', |
|
162 | + 'type' => 'text', |
|
163 | + ); |
|
164 | + $fields[] = array( |
|
165 | + 'id' => 'price', |
|
166 | + 'name' => 'Price Guide', |
|
167 | + 'type' => 'text', |
|
168 | + ); |
|
169 | + $fields[] = array( |
|
170 | + 'id' => 'engine_type', |
|
171 | + 'name' => 'Engine Type', |
|
172 | + 'type' => 'radio', |
|
173 | + 'options' => array( |
|
174 | + 'Diesel' => 'Diesel', |
|
175 | + 'Petrol' => 'Petrol', |
|
176 | + ), |
|
177 | + ); |
|
178 | + $fields[] = array( |
|
179 | + 'id' => 'engine_size', |
|
180 | + 'name' => 'Engine Size', |
|
181 | + 'type' => 'text', |
|
182 | + ); |
|
183 | + $fields[] = array( |
|
184 | + 'id' => 'seating', |
|
185 | + 'name' => 'Seats', |
|
186 | + 'type' => 'text', |
|
187 | + ); |
|
188 | + $fields[] = array( |
|
189 | + 'id' => 'features', |
|
190 | + 'name' => 'Features', |
|
191 | + 'type' => 'wysiwyg', |
|
192 | + 'options' => array( |
|
193 | + 'editor_height' => '100', |
|
194 | + ), |
|
195 | + ); |
|
196 | + $fields[] = array( |
|
197 | + 'id' => 'gallery_title', |
|
198 | + 'name' => 'Gallery', |
|
199 | + 'type' => 'title', |
|
200 | + ); |
|
201 | 201 | |
202 | - //Galleries Block |
|
203 | - $fields[] = array( |
|
204 | - 'id' => 'gallery_title', |
|
205 | - 'name' => esc_html__( 'Gallery', 'tour-operator' ), |
|
206 | - 'type' => 'title', |
|
207 | - ); |
|
208 | - $fields[] = array( |
|
209 | - 'id' => 'gallery', |
|
210 | - 'name' => '', |
|
211 | - 'type' => 'image', |
|
212 | - 'repeatable' => true, |
|
213 | - 'show_size' => false, |
|
214 | - 'sortable' => true, |
|
215 | - 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), |
|
216 | - ); |
|
217 | - if ( class_exists( 'Envira_Gallery' ) ) { |
|
218 | - $fields[] = array( |
|
219 | - 'id' => 'envira_title', |
|
220 | - 'name' => esc_html__( 'Envira Gallery', 'tour-operator' ), |
|
221 | - 'type' => 'title', |
|
222 | - ); |
|
223 | - $fields[] = array( |
|
224 | - 'id' => 'envira_gallery', |
|
225 | - 'name' => esc_html__( 'Envira Gallery', 'to-galleries' ), |
|
226 | - 'type' => 'post_select', |
|
227 | - 'use_ajax' => false, |
|
228 | - 'query' => array( |
|
229 | - 'post_type' => 'envira', |
|
230 | - 'nopagin' => true, |
|
231 | - 'posts_per_page' => '-1', |
|
232 | - 'orderby' => 'title', |
|
233 | - 'order' => 'ASC', |
|
234 | - ), |
|
235 | - 'allow_none' => true, |
|
236 | - ); |
|
237 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
238 | - $fields[] = array( |
|
239 | - 'id' => 'envira_video', |
|
240 | - 'name' => esc_html__( 'Envira Video Gallery', 'to-galleries' ), |
|
241 | - 'type' => 'post_select', |
|
242 | - 'use_ajax' => false, |
|
243 | - 'query' => array( |
|
244 | - 'post_type' => 'envira', |
|
245 | - 'nopagin' => true, |
|
246 | - 'posts_per_page' => '-1', |
|
247 | - 'orderby' => 'title', |
|
248 | - 'order' => 'ASC', |
|
249 | - ), |
|
250 | - 'allow_none' => true, |
|
251 | - ); |
|
252 | - } |
|
253 | - } |
|
202 | + //Galleries Block |
|
203 | + $fields[] = array( |
|
204 | + 'id' => 'gallery_title', |
|
205 | + 'name' => esc_html__( 'Gallery', 'tour-operator' ), |
|
206 | + 'type' => 'title', |
|
207 | + ); |
|
208 | + $fields[] = array( |
|
209 | + 'id' => 'gallery', |
|
210 | + 'name' => '', |
|
211 | + 'type' => 'image', |
|
212 | + 'repeatable' => true, |
|
213 | + 'show_size' => false, |
|
214 | + 'sortable' => true, |
|
215 | + 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), |
|
216 | + ); |
|
217 | + if ( class_exists( 'Envira_Gallery' ) ) { |
|
218 | + $fields[] = array( |
|
219 | + 'id' => 'envira_title', |
|
220 | + 'name' => esc_html__( 'Envira Gallery', 'tour-operator' ), |
|
221 | + 'type' => 'title', |
|
222 | + ); |
|
223 | + $fields[] = array( |
|
224 | + 'id' => 'envira_gallery', |
|
225 | + 'name' => esc_html__( 'Envira Gallery', 'to-galleries' ), |
|
226 | + 'type' => 'post_select', |
|
227 | + 'use_ajax' => false, |
|
228 | + 'query' => array( |
|
229 | + 'post_type' => 'envira', |
|
230 | + 'nopagin' => true, |
|
231 | + 'posts_per_page' => '-1', |
|
232 | + 'orderby' => 'title', |
|
233 | + 'order' => 'ASC', |
|
234 | + ), |
|
235 | + 'allow_none' => true, |
|
236 | + ); |
|
237 | + if ( class_exists( 'Envira_Videos' ) ) { |
|
238 | + $fields[] = array( |
|
239 | + 'id' => 'envira_video', |
|
240 | + 'name' => esc_html__( 'Envira Video Gallery', 'to-galleries' ), |
|
241 | + 'type' => 'post_select', |
|
242 | + 'use_ajax' => false, |
|
243 | + 'query' => array( |
|
244 | + 'post_type' => 'envira', |
|
245 | + 'nopagin' => true, |
|
246 | + 'posts_per_page' => '-1', |
|
247 | + 'orderby' => 'title', |
|
248 | + 'order' => 'ASC', |
|
249 | + ), |
|
250 | + 'allow_none' => true, |
|
251 | + ); |
|
252 | + } |
|
253 | + } |
|
254 | 254 | |
255 | - if ( class_exists( 'LSX_Field_Pattern' ) ) { |
|
256 | - $fields = array_merge( $fields, LSX_Field_Pattern::videos() ); |
|
257 | - } |
|
255 | + if ( class_exists( 'LSX_Field_Pattern' ) ) { |
|
256 | + $fields = array_merge( $fields, LSX_Field_Pattern::videos() ); |
|
257 | + } |
|
258 | 258 | |
259 | - $fields[] = array( |
|
260 | - 'id' => 'accommodation_title', |
|
261 | - 'name' => 'Accommodation', |
|
262 | - 'type' => 'title', |
|
263 | - ); |
|
264 | - $fields[] = array( |
|
265 | - 'id' => 'accommodation_to_vehicle', |
|
266 | - 'name' => 'Accommodations related with this vehicle', |
|
267 | - 'type' => 'post_select', |
|
268 | - 'use_ajax' => false, |
|
269 | - 'query' => array( |
|
270 | - 'post_type' => 'accommodation', |
|
271 | - 'nopagin' => true, |
|
272 | - 'posts_per_page' => 1000, |
|
273 | - 'orderby' => 'title', |
|
274 | - 'order' => 'ASC', |
|
275 | - ), |
|
276 | - 'repeatable' => true, |
|
277 | - 'sortable' => true, |
|
278 | - 'allow_none' => true, |
|
279 | - ); |
|
280 | - $fields[] = array( |
|
281 | - 'id' => 'activity_title', |
|
282 | - 'name' => 'Activities', |
|
283 | - 'type' => 'title', |
|
284 | - ); |
|
285 | - $fields[] = array( |
|
286 | - 'id' => 'activity_to_vehicle', |
|
287 | - 'name' => 'Activities related with this vehicle', |
|
288 | - 'type' => 'post_select', |
|
289 | - 'use_ajax' => false, |
|
290 | - 'query' => array( |
|
291 | - 'post_type' => 'activity', |
|
292 | - 'nopagin' => true, |
|
293 | - 'posts_per_page' => 1000, |
|
294 | - 'orderby' => 'title', |
|
295 | - 'order' => 'ASC', |
|
296 | - ), |
|
297 | - 'repeatable' => true, |
|
298 | - 'sortable' => true, |
|
299 | - 'allow_none' => true, |
|
300 | - ); |
|
301 | - $fields[] = array( |
|
302 | - 'id' => 'destinations_title', |
|
303 | - 'name' => 'Destinations', |
|
304 | - 'type' => 'title', |
|
305 | - ); |
|
306 | - $fields[] = array( |
|
307 | - 'id' => 'destination_to_vehicle', |
|
308 | - 'name' => 'Destinations related with this vehicle', |
|
309 | - 'type' => 'post_select', |
|
310 | - 'use_ajax' => false, |
|
311 | - 'query' => array( |
|
312 | - 'post_type' => 'destination', |
|
313 | - 'nopagin' => true, |
|
314 | - 'posts_per_page' => 1000, |
|
315 | - 'orderby' => 'title', |
|
316 | - 'order' => 'ASC', |
|
317 | - ), |
|
318 | - 'repeatable' => true, |
|
319 | - 'sortable' => true, |
|
320 | - 'allow_none' => true, |
|
321 | - ); |
|
322 | - $fields[] = array( |
|
323 | - 'id' => 'review_title', |
|
324 | - 'name' => 'Reviews', |
|
325 | - 'type' => 'title', |
|
326 | - ); |
|
327 | - $fields[] = array( |
|
328 | - 'id' => 'review_to_vehicle', |
|
329 | - 'name' => 'Reviews related with this vehicle', |
|
330 | - 'type' => 'post_select', |
|
331 | - 'use_ajax' => false, |
|
332 | - 'query' => array( |
|
333 | - 'post_type' => 'reviews', |
|
334 | - 'nopagin' => true, |
|
335 | - 'posts_per_page' => 1000, |
|
336 | - 'orderby' => 'title', |
|
337 | - 'order' => 'ASC', |
|
338 | - ), |
|
339 | - 'repeatable' => true, |
|
340 | - 'sortable' => true, |
|
341 | - 'allow_none' => true, |
|
342 | - ); |
|
343 | - $fields[] = array( |
|
344 | - 'id' => 'specials_title', |
|
345 | - 'name' => 'Specials', |
|
346 | - 'type' => 'title', |
|
347 | - ); |
|
348 | - $fields[] = array( |
|
349 | - 'id' => 'special_to_vehicle', |
|
350 | - 'name' => 'Specials related with this vehicle', |
|
351 | - 'type' => 'post_select', |
|
352 | - 'use_ajax' => false, |
|
353 | - 'query' => array( |
|
354 | - 'post_type' => 'special', |
|
355 | - 'nopagin' => true, |
|
356 | - 'posts_per_page' => 1000, |
|
357 | - 'orderby' => 'title', |
|
358 | - 'order' => 'ASC', |
|
359 | - ), |
|
360 | - 'repeatable' => true, |
|
361 | - 'sortable' => true, |
|
362 | - 'allow_none' => true, |
|
363 | - ); |
|
364 | - $fields[] = array( |
|
365 | - 'id' => 'team_title', |
|
366 | - 'name' => 'Team Members', |
|
367 | - 'type' => 'title', |
|
368 | - ); |
|
369 | - $fields[] = array( |
|
370 | - 'id' => 'team_to_vehicle', |
|
371 | - 'name' => 'Team members related with this vehicle', |
|
372 | - 'type' => 'post_select', |
|
373 | - 'use_ajax' => false, |
|
374 | - 'query' => array( |
|
375 | - 'post_type' => 'team', |
|
376 | - 'nopagin' => true, |
|
377 | - 'posts_per_page' => 1000, |
|
378 | - 'orderby' => 'title', |
|
379 | - 'order' => 'ASC', |
|
380 | - ), |
|
381 | - 'repeatable' => true, |
|
382 | - 'sortable' => true, |
|
383 | - 'allow_none' => true, |
|
384 | - ); |
|
385 | - $fields[] = array( |
|
386 | - 'id' => 'tours_title', |
|
387 | - 'name' => 'Tours', |
|
388 | - 'type' => 'title', |
|
389 | - ); |
|
390 | - $fields[] = array( |
|
391 | - 'id' => 'tour_to_vehicle', |
|
392 | - 'name' => 'Tours related with this vehicle', |
|
393 | - 'type' => 'post_select', |
|
394 | - 'use_ajax' => false, |
|
395 | - 'query' => array( |
|
396 | - 'post_type' => 'tour', |
|
397 | - 'nopagin' => true, |
|
398 | - 'posts_per_page' => 1000, |
|
399 | - 'orderby' => 'title', |
|
400 | - 'order' => 'ASC', |
|
401 | - ), |
|
402 | - 'repeatable' => true, |
|
403 | - 'sortable' => true, |
|
404 | - 'allow_none' => true, |
|
405 | - ); |
|
259 | + $fields[] = array( |
|
260 | + 'id' => 'accommodation_title', |
|
261 | + 'name' => 'Accommodation', |
|
262 | + 'type' => 'title', |
|
263 | + ); |
|
264 | + $fields[] = array( |
|
265 | + 'id' => 'accommodation_to_vehicle', |
|
266 | + 'name' => 'Accommodations related with this vehicle', |
|
267 | + 'type' => 'post_select', |
|
268 | + 'use_ajax' => false, |
|
269 | + 'query' => array( |
|
270 | + 'post_type' => 'accommodation', |
|
271 | + 'nopagin' => true, |
|
272 | + 'posts_per_page' => 1000, |
|
273 | + 'orderby' => 'title', |
|
274 | + 'order' => 'ASC', |
|
275 | + ), |
|
276 | + 'repeatable' => true, |
|
277 | + 'sortable' => true, |
|
278 | + 'allow_none' => true, |
|
279 | + ); |
|
280 | + $fields[] = array( |
|
281 | + 'id' => 'activity_title', |
|
282 | + 'name' => 'Activities', |
|
283 | + 'type' => 'title', |
|
284 | + ); |
|
285 | + $fields[] = array( |
|
286 | + 'id' => 'activity_to_vehicle', |
|
287 | + 'name' => 'Activities related with this vehicle', |
|
288 | + 'type' => 'post_select', |
|
289 | + 'use_ajax' => false, |
|
290 | + 'query' => array( |
|
291 | + 'post_type' => 'activity', |
|
292 | + 'nopagin' => true, |
|
293 | + 'posts_per_page' => 1000, |
|
294 | + 'orderby' => 'title', |
|
295 | + 'order' => 'ASC', |
|
296 | + ), |
|
297 | + 'repeatable' => true, |
|
298 | + 'sortable' => true, |
|
299 | + 'allow_none' => true, |
|
300 | + ); |
|
301 | + $fields[] = array( |
|
302 | + 'id' => 'destinations_title', |
|
303 | + 'name' => 'Destinations', |
|
304 | + 'type' => 'title', |
|
305 | + ); |
|
306 | + $fields[] = array( |
|
307 | + 'id' => 'destination_to_vehicle', |
|
308 | + 'name' => 'Destinations related with this vehicle', |
|
309 | + 'type' => 'post_select', |
|
310 | + 'use_ajax' => false, |
|
311 | + 'query' => array( |
|
312 | + 'post_type' => 'destination', |
|
313 | + 'nopagin' => true, |
|
314 | + 'posts_per_page' => 1000, |
|
315 | + 'orderby' => 'title', |
|
316 | + 'order' => 'ASC', |
|
317 | + ), |
|
318 | + 'repeatable' => true, |
|
319 | + 'sortable' => true, |
|
320 | + 'allow_none' => true, |
|
321 | + ); |
|
322 | + $fields[] = array( |
|
323 | + 'id' => 'review_title', |
|
324 | + 'name' => 'Reviews', |
|
325 | + 'type' => 'title', |
|
326 | + ); |
|
327 | + $fields[] = array( |
|
328 | + 'id' => 'review_to_vehicle', |
|
329 | + 'name' => 'Reviews related with this vehicle', |
|
330 | + 'type' => 'post_select', |
|
331 | + 'use_ajax' => false, |
|
332 | + 'query' => array( |
|
333 | + 'post_type' => 'reviews', |
|
334 | + 'nopagin' => true, |
|
335 | + 'posts_per_page' => 1000, |
|
336 | + 'orderby' => 'title', |
|
337 | + 'order' => 'ASC', |
|
338 | + ), |
|
339 | + 'repeatable' => true, |
|
340 | + 'sortable' => true, |
|
341 | + 'allow_none' => true, |
|
342 | + ); |
|
343 | + $fields[] = array( |
|
344 | + 'id' => 'specials_title', |
|
345 | + 'name' => 'Specials', |
|
346 | + 'type' => 'title', |
|
347 | + ); |
|
348 | + $fields[] = array( |
|
349 | + 'id' => 'special_to_vehicle', |
|
350 | + 'name' => 'Specials related with this vehicle', |
|
351 | + 'type' => 'post_select', |
|
352 | + 'use_ajax' => false, |
|
353 | + 'query' => array( |
|
354 | + 'post_type' => 'special', |
|
355 | + 'nopagin' => true, |
|
356 | + 'posts_per_page' => 1000, |
|
357 | + 'orderby' => 'title', |
|
358 | + 'order' => 'ASC', |
|
359 | + ), |
|
360 | + 'repeatable' => true, |
|
361 | + 'sortable' => true, |
|
362 | + 'allow_none' => true, |
|
363 | + ); |
|
364 | + $fields[] = array( |
|
365 | + 'id' => 'team_title', |
|
366 | + 'name' => 'Team Members', |
|
367 | + 'type' => 'title', |
|
368 | + ); |
|
369 | + $fields[] = array( |
|
370 | + 'id' => 'team_to_vehicle', |
|
371 | + 'name' => 'Team members related with this vehicle', |
|
372 | + 'type' => 'post_select', |
|
373 | + 'use_ajax' => false, |
|
374 | + 'query' => array( |
|
375 | + 'post_type' => 'team', |
|
376 | + 'nopagin' => true, |
|
377 | + 'posts_per_page' => 1000, |
|
378 | + 'orderby' => 'title', |
|
379 | + 'order' => 'ASC', |
|
380 | + ), |
|
381 | + 'repeatable' => true, |
|
382 | + 'sortable' => true, |
|
383 | + 'allow_none' => true, |
|
384 | + ); |
|
385 | + $fields[] = array( |
|
386 | + 'id' => 'tours_title', |
|
387 | + 'name' => 'Tours', |
|
388 | + 'type' => 'title', |
|
389 | + ); |
|
390 | + $fields[] = array( |
|
391 | + 'id' => 'tour_to_vehicle', |
|
392 | + 'name' => 'Tours related with this vehicle', |
|
393 | + 'type' => 'post_select', |
|
394 | + 'use_ajax' => false, |
|
395 | + 'query' => array( |
|
396 | + 'post_type' => 'tour', |
|
397 | + 'nopagin' => true, |
|
398 | + 'posts_per_page' => 1000, |
|
399 | + 'orderby' => 'title', |
|
400 | + 'order' => 'ASC', |
|
401 | + ), |
|
402 | + 'repeatable' => true, |
|
403 | + 'sortable' => true, |
|
404 | + 'allow_none' => true, |
|
405 | + ); |
|
406 | 406 | |
407 | - $fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields ); |
|
407 | + $fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields ); |
|
408 | 408 | |
409 | - $meta_boxes[] = array( |
|
410 | - 'title' => 'Tour Operator Plugin', |
|
411 | - 'pages' => 'vehicle', |
|
412 | - 'fields' => $fields, |
|
413 | - ); |
|
414 | - return $meta_boxes; |
|
409 | + $meta_boxes[] = array( |
|
410 | + 'title' => 'Tour Operator Plugin', |
|
411 | + 'pages' => 'vehicle', |
|
412 | + 'fields' => $fields, |
|
413 | + ); |
|
414 | + return $meta_boxes; |
|
415 | 415 | |
416 | - } |
|
416 | + } |
|
417 | 417 | |
418 | - /** |
|
419 | - * Adds in the gallery fields to the Tour Operators Post Types. |
|
420 | - */ |
|
421 | - public function custom_fields( $fields ) { |
|
422 | - global $post, $typenow, $current_screen; |
|
418 | + /** |
|
419 | + * Adds in the gallery fields to the Tour Operators Post Types. |
|
420 | + */ |
|
421 | + public function custom_fields( $fields ) { |
|
422 | + global $post, $typenow, $current_screen; |
|
423 | 423 | |
424 | - $post_type = false; |
|
425 | - if ( $post && $post->post_type ) { |
|
426 | - $post_type = $post->post_type; |
|
427 | - } elseif ( $typenow ) { |
|
428 | - $post_type = $typenow; |
|
429 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
430 | - $post_type = $current_screen->post_type; |
|
431 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
432 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
433 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
434 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
435 | - } |
|
436 | - //$post_type = get_post_type(); |
|
437 | - if ( false !== $post_type ) { |
|
438 | - $fields[] = array( |
|
439 | - 'id' => 'vehicle_title', |
|
440 | - 'name' => 'Vehicles', |
|
441 | - 'type' => 'title', |
|
442 | - 'cols' => 12, |
|
443 | - ); |
|
444 | - $fields[] = array( |
|
445 | - 'id' => 'vehicle_to_' . $post_type, |
|
446 | - 'name' => 'Vehicles related with this ' . $post_type, |
|
447 | - 'type' => 'post_select', |
|
448 | - 'use_ajax' => false, |
|
449 | - 'query' => array( |
|
450 | - 'post_type' => 'vehicle', |
|
451 | - 'nopagin' => true, |
|
452 | - 'posts_per_page' => '-1', |
|
453 | - 'orderby' => 'title', |
|
454 | - 'order' => 'ASC', |
|
455 | - ), |
|
456 | - 'repeatable' => true, |
|
457 | - 'allow_none' => true, |
|
458 | - 'cols' => 12, |
|
459 | - ); |
|
460 | - } |
|
461 | - return $fields; |
|
462 | - } |
|
424 | + $post_type = false; |
|
425 | + if ( $post && $post->post_type ) { |
|
426 | + $post_type = $post->post_type; |
|
427 | + } elseif ( $typenow ) { |
|
428 | + $post_type = $typenow; |
|
429 | + } elseif ( $current_screen && $current_screen->post_type ) { |
|
430 | + $post_type = $current_screen->post_type; |
|
431 | + } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
432 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
433 | + } elseif ( isset( $_REQUEST['post'] ) ) { |
|
434 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
435 | + } |
|
436 | + //$post_type = get_post_type(); |
|
437 | + if ( false !== $post_type ) { |
|
438 | + $fields[] = array( |
|
439 | + 'id' => 'vehicle_title', |
|
440 | + 'name' => 'Vehicles', |
|
441 | + 'type' => 'title', |
|
442 | + 'cols' => 12, |
|
443 | + ); |
|
444 | + $fields[] = array( |
|
445 | + 'id' => 'vehicle_to_' . $post_type, |
|
446 | + 'name' => 'Vehicles related with this ' . $post_type, |
|
447 | + 'type' => 'post_select', |
|
448 | + 'use_ajax' => false, |
|
449 | + 'query' => array( |
|
450 | + 'post_type' => 'vehicle', |
|
451 | + 'nopagin' => true, |
|
452 | + 'posts_per_page' => '-1', |
|
453 | + 'orderby' => 'title', |
|
454 | + 'order' => 'ASC', |
|
455 | + ), |
|
456 | + 'repeatable' => true, |
|
457 | + 'allow_none' => true, |
|
458 | + 'cols' => 12, |
|
459 | + ); |
|
460 | + } |
|
461 | + return $fields; |
|
462 | + } |
|
463 | 463 | } |
464 | 464 | new LSX_TO_Vehicles_Admin(); |