PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.2
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.2
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / includes / updates / update-2.2.0.php

update-2.2.0.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.2, at includes/updates/update-2.2.0.php

305 lines 11.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 update_option( 'smart_post_show_version', '2.2.0' );
3 update_option( 'smart_post_show_db_version', '2.2.0' );
4
5 /**
6 * Update settings.
7 */
8 $setting_options = array(
9 'pcp_delete_all_data' => false,
10 'pcp_swiper_js' => true,
11 'pcp_swiper_css' => true,
12 'pcp_fontawesome_css' => true,
13 'accessibility' => false,
14 'pcp_custom_css' => '',
15 'pcp_custom_js' => '',
16 );
17 update_option( 'sp_post_carousel_settings', $setting_options );
18
19 /**
20 * Shortcode query for id.
21 */
22 $args = new WP_Query(
23 array(
24 'post_type' => 'sp_pc_shortcodes',
25 'post_status' => 'any',
26 'posts_per_page' => '300',
27 )
28 );
29 $shortcode_ids = wp_list_pluck( $args->posts, 'ID' );
30
31 if ( count( $shortcode_ids ) > 0 ) {
32 foreach ( $shortcode_ids as $shortcode_key => $shortcode_id ) {
33
34 $number_of_total_posts = intval( get_post_meta( $shortcode_id, 'pc_number_of_total_posts', true ) );
35 $number_of_column = intval( get_post_meta( $shortcode_id, 'pc_number_of_column', true ) );
36 $number_of_column_desktop = intval( get_post_meta( $shortcode_id, 'pc_number_of_column_desktop', true ) );
37 $number_of_column_tablet = intval( get_post_meta( $shortcode_id, 'pc_number_of_column_tablet', true ) );
38 $number_of_column_mobile = intval( get_post_meta( $shortcode_id, 'pc_number_of_column_mobile', true ) );
39 $auto_play_speed = get_post_meta( $shortcode_id, 'pc_auto_play_speed', true );
40 $nav_arrow_color = get_post_meta( $shortcode_id, 'pc_nav_arrow_color', true );
41 $nav_arrow_bg = get_post_meta( $shortcode_id, 'pc_nav_arrow_bg', true );
42 $pagination_color = get_post_meta( $shortcode_id, 'pc_pagination_color', true );
43 $pagination_active_color = get_post_meta( $shortcode_id, 'pc_pagination_active_color', true );
44 $scroll_speed = get_post_meta( $shortcode_id, 'pc_scroll_speed', true );
45 $post_title_color = get_post_meta( $shortcode_id, 'pc_post_title_color', true );
46 $post_title_hover_color = get_post_meta( $shortcode_id, 'pc_post_title_hover_color', true );
47 $post_content_color = get_post_meta( $shortcode_id, 'pc_post_content_color', true );
48 $post_meta_color = get_post_meta( $shortcode_id, 'pc_post_meta_color', true );
49 $post_meta_hover_color = get_post_meta( $shortcode_id, 'pc_post_meta_hover_color', true );
50 $carousel_title_color = get_post_meta( $shortcode_id, 'pc_carousel_title_color', true );
51 $themes = get_post_meta( $shortcode_id, 'pc_themes', true );
52 $post_title = get_post_meta( $shortcode_id, 'pc_post_title', 'true' );
53 $post_content = get_post_meta( $shortcode_id, 'pc_post_content', 'true' );
54 // $post_author = get_post_meta( $shortcode_id, 'pc_post_author', 'true' );
55 // $post_date = get_post_meta( $shortcode_id, 'pc_post_date', 'true' );
56 $section_title_data = get_post_meta( $shortcode_id, 'pc_carousel_title', true );
57 $section_title = ( 'on' == $section_title_data ) ? true : false;
58
59 $view_options['pcp_select_post_type'] = 'post';
60 $view_options['pcp_include_only_posts'] = '';
61 $view_options['pcp_exclude_post_set'] = '';
62 $view_options['pcp_post_limit'] = $number_of_total_posts;
63 $view_options['pcp_advanced_filter'] = '';
64 $view_options['section_title'] = $section_title;
65 $view_options['section_title_margin'] = array(
66 'top' => '0',
67 'right' => '0',
68 'bottom' => '30',
69 'top' => '0',
70 );
71 $view_options['pcp_number_of_columns'] = array(
72 'lg_desktop' => $number_of_column,
73 'desktop' => $number_of_column_desktop,
74 'tablet' => $number_of_column_tablet,
75 'mobile_landscape' => $number_of_column_tablet,
76 'mobile' => $number_of_column_mobile,
77 );
78 $view_options['margin_between_post'] = array(
79 'all' => '20',
80 );
81 $view_options['post_content_orientation'] = 'default';
82 $border_size = ( 'carousel_two' == $themes ) ? '1' : '0';
83 $border_color = ( 'carousel_two' == $themes ) ? '#ddd' : '#e2e2e2';
84 $view_options['post_border'] = array(
85 'all' => $border_size,
86 'style' => 'solid',
87 'color' => $border_color,
88 );
89 $view_options['post_border_radius_property'] = array(
90 'all' => '0',
91 );
92 $view_options['post_background_property'] = 'transparent';
93 $inner_padding = ( 'carousel_two' == $themes ) ? '15' : '0';
94 $view_options['post_inner_padding_property'] = array(
95 'top' => $inner_padding,
96 'right' => $inner_padding,
97 'bottom' => $inner_padding,
98 'left' => $inner_padding,
99 'unit' => 'px',
100 );
101 $view_options['post_content_sorter'] = array(
102 'pcp_post_thumb' => array(
103 'post_thumb_show' => true,
104 'pcp_thumb_sizes' => 'full',
105 ),
106 'pcp_post_title' => array(
107 'show_post_title' => ( 'on' == $post_title ) ? true : false,
108 'post_title_tag' => 'h2',
109 ),
110 'pcp_post_meta' => array(
111 'show_post_meta' => true,
112 'pcp_post_meta_group' => array(
113 array(
114 'select_post_meta' => 'author',
115 'select_meta_icon' => 'fa fa-user',
116 ),
117 array(
118 'select_post_meta' => 'date',
119 'select_meta_icon' => 'fa fa-calendar',
120 ),
121 ),
122 ),
123 'pcp_post_content' => array(
124 'show_post_content' => ( 'hide' == $post_content ) ? false : true,
125 'post_content_type' => ( 'content_with_limit' == $post_content ) ? 'excerpt' : 'full_content',
126 'show_read_more' => false,
127 'pcp_read_label' => 'Read More',
128 'readmore_color_button' => array(
129 'standard' => '#111',
130 'hover' => '#fff',
131 'bg' => 'transparent',
132 'hover_bg' => '#e1624b',
133 'border' => '#888',
134 'hover_border' => '#e1624b',
135 ),
136 ),
137 );
138 $view_options['show_post_pagination'] = false;
139 $view_options['post_pagination_type'] = 'no_ajax';
140 $view_options['pcp_pagination_btn_color'] = array(
141 'text_color' => '#5e5e5e',
142 'text_acolor' => '#ffffff',
143 'border_color' => '#bbbbbb',
144 'border_acolor' => '#e1624b',
145 'background' => '#ffffff',
146 'active_background' => '#e1624b',
147 );
148 $view_options['post_per_page'] = 12;
149 $view_options['show_preloader'] = false;
150
151 $view_options['pcp_carousel_speed'] = $scroll_speed;
152 $auto_play = get_post_meta( $shortcode_id, 'pc_auto_play', 'true' );
153 $view_options['pcp_autoplay'] = ( 'on' == $auto_play ) ? true : false;
154 $view_options['pcp_autoplay_speed'] = $auto_play_speed;
155 $pause_on_hover = get_post_meta( $shortcode_id, 'pc_pause_on_hover', 'true' );
156 $view_options['pcp_pause_hover'] = ( 'on' == $pause_on_hover ) ? true : false;
157 $view_options['pcp_infinite_loop'] = true;
158 $view_options['pcp_lazy_load'] = false;
159 $rtl = get_post_meta( $shortcode_id, 'pc_rtl', 'true' );
160 $view_options['pcp_carousel_direction'] = $rtl;
161 $show_navigation = get_post_meta( $shortcode_id, 'pc_show_navigation', 'true' );
162 $view_options['pcp_navigation'] = ( 'on' == $show_navigation ) ? 'show' : 'hide';
163 $view_options['pcp_nav_colors'] = array(
164 'color' => $nav_arrow_color,
165 'hover-color' => $nav_arrow_color,
166 'bg' => $nav_arrow_bg,
167 'hover-bg' => $nav_arrow_bg,
168 'border-color' => $nav_arrow_bg,
169 'hover-border-color' => $nav_arrow_bg,
170 );
171 $show_pagination_dots = get_post_meta( $shortcode_id, 'pc_show_pagination_dots', 'true' );
172 $view_options['pcp_pagination'] = ( 'on' == $show_pagination_dots ) ? 'show' : 'hide';
173 $view_options['pcp_pagination_color_set'] = array(
174 'pcp_pagination_color' => array(
175 'color' => $pagination_color,
176 'active-color' => $pagination_active_color,
177 ),
178 );
179 $view_options['pcp_adaptive_height'] = '';
180 $view_options['pcp_accessibility'] = false;
181 $touch_swipe = get_post_meta( $shortcode_id, 'pc_touch_swipe', 'true' );
182 $view_options['touch_swipe'] = ( 'on' == $touch_swipe ) ? true : false;
183 $mouse_draggable = get_post_meta( $shortcode_id, 'pc_mouse_draggable', 'true' );
184 $view_options['slider_draggable'] = ( 'on' == $mouse_draggable ) ? true : false;
185
186 $view_options['pcp_page_link_type'] = 'single_page';
187 $view_options['pcp_link_target'] = '_self';
188 $view_options['pcp_link_rel'] = 'false';
189
190 $view_options['post_title_typography'] = array(
191 'color' => $post_title_color,
192 'hover_color' => $post_title_hover_color,
193 'font-family' => '',
194 'font-weight' => '',
195 'subset' => '',
196 'font-size' => '20',
197 'tablet-font-size' => '18',
198 'mobile-font-size' => '16',
199 'line-height' => '24',
200 'tablet-line-height' => '22',
201 'mobile-line-height' => '20',
202 'letter-spacing' => '0',
203 'text-align' => 'left',
204 'text-transform' => 'none',
205 'type' => '',
206 'unit' => 'px',
207 );
208 $view_options['post_content_typography'] = array(
209 'color' => $post_content_color,
210 'font-family' => '',
211 'font-weight' => '',
212 'subset' => '',
213 'font-size' => '16',
214 'tablet-font-size' => '14',
215 'mobile-font-size' => '12',
216 'line-height' => '20',
217 'tablet-line-height' => '18',
218 'mobile-line-height' => '18',
219 'letter-spacing' => '0',
220 'text-align' => 'left',
221 'text-transform' => 'none',
222 'type' => '',
223 'unit' => 'px',
224 );
225 $view_options['post_meta_typography'] = array(
226 'color' => $post_meta_color,
227 'hover_color' => $post_meta_hover_color,
228 'font-family' => '',
229 'font-weight' => '',
230 'subset' => '',
231 'font-size' => '14',
232 'tablet-font-size' => '14',
233 'mobile-font-size' => '12',
234 'line-height' => '16',
235 'tablet-line-height' => '16',
236 'mobile-line-height' => '16',
237 'letter-spacing' => '0',
238 'text-align' => 'left',
239 'text-transform' => 'none',
240 'type' => '',
241 'unit' => 'px',
242 );
243 $view_options['section_title_typography'] = array(
244 'color' => $carousel_title_color,
245 'font-family' => '',
246 'font-weight' => '',
247 'subset' => '',
248 'font-size' => '24',
249 'tablet-font-size' => '20',
250 'mobile-font-size' => '18',
251 'line-height' => '28',
252 'tablet-line-height' => '24',
253 'mobile-line-height' => '20',
254 'letter-spacing' => '0',
255 'text-align' => 'left',
256 'text-transform' => 'none',
257 'type' => '',
258 'unit' => 'px',
259 );
260
261 /**
262 * Layouts.
263 */
264 $layouts['pcp_layout_preset'] = 'carousel_layout';
265
266 update_post_meta( $shortcode_id, 'sp_pcp_view_options', $view_options );
267 update_post_meta( $shortcode_id, 'sp_pcp_layouts', $layouts );
268 }
269
270 /**
271 * Old post type to new for shortcode.
272 */
273 global $wpdb;
274 $old_post_types = array( 'sp_pc_shortcodes' => 'sp_post_carousel' );
275 foreach ( $old_post_types as $old_type => $type ) {
276 $wpdb->query(
277 $wpdb->prepare(
278 "UPDATE {$wpdb->posts} SET post_type = REPLACE(post_type, %s, %s)
279 WHERE post_type LIKE %s",
280 $old_type,
281 $type,
282 $old_type
283 )
284 );
285 $wpdb->query(
286 $wpdb->prepare(
287 "UPDATE {$wpdb->posts} SET guid = REPLACE(guid, %s, %s)
288 WHERE guid LIKE %s",
289 "post_type={$old_type}",
290 "post_type={$type}",
291 "%post_type={$type}%"
292 )
293 );
294 $wpdb->query(
295 $wpdb->prepare(
296 "UPDATE {$wpdb->posts} SET guid = REPLACE(guid, %s, %s)
297 WHERE guid LIKE %s",
298 "/{$old_type}/",
299 "/{$type}/",
300 "%/{$old_type}/%"
301 )
302 );
303 }
304 }
305