PluginProbe
Related Posts By PickPlugins / trunk
Related Posts By PickPlugins vtrunk
trunk 1.0 1.1 1.2 2.0.0 2.0.1 2.0.10 2.0.11 2.0.14 2.0.16 2.0.17 2.0.18 2.0.19 2.0.2 2.0.20 2.0.21 2.0.22 2.0.23 2.0.24 2.0.25 2.0.26 2.0.27 2.0.28 2.0.29 2.0.30 All 60 releases
related-post / includes / functions-settings.php

functions-settings.php in Related Posts By PickPlugins trunk, at includes/functions-settings.php

2,010 lines 95.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 if (!defined('ABSPATH')) exit; // if direct access
5
6
7 add_action('related_post_settings_content_general', 'related_post_settings_content_general');
8
9 if (!function_exists('related_post_settings_content_general')) {
10 function related_post_settings_content_general($tab)
11 {
12
13
14 //delete_option('related_post_settings');
15
16 $settings_tabs_field = new settings_tabs_field();
17
18 $related_post_settings = get_option('related_post_settings');
19
20 $display_auto = isset($related_post_settings['display_auto']) ? $related_post_settings['display_auto'] : 'yes';
21 $post_types = isset($related_post_settings['post_types']) ? $related_post_settings['post_types'] : array();
22 $post_types_display = isset($related_post_settings['post_types_display']) ? $related_post_settings['post_types_display'] : array();
23
24 $headline_text = isset($related_post_settings['headline_text']) ? $related_post_settings['headline_text'] : __('Related Posts', 'related-post');
25 $headline_text_tag = isset($related_post_settings['headline_text_style']['tag']) ? $related_post_settings['headline_text_style']['tag'] : 'div';
26 $headline_text_font_size = isset($related_post_settings['headline_text_style']['font_size']) ? $related_post_settings['headline_text_style']['font_size'] : '';
27 $headline_text_color = isset($related_post_settings['headline_text_style']['color']) ? $related_post_settings['headline_text_style']['color'] : '';
28 $headline_text_custom_css = isset($related_post_settings['headline_text_style']['custom_css']) ? $related_post_settings['headline_text_style']['custom_css'] : '';
29
30
31 $content_positions = isset($related_post_settings['content_positions']) ? $related_post_settings['content_positions'] : array();
32 $excerpt_positions = isset($related_post_settings['excerpt_positions']) ? $related_post_settings['excerpt_positions'] : array();
33
34 $paragraph_positions = isset($related_post_settings['paragraph_positions']) ? $related_post_settings['paragraph_positions'] : array();
35
36 $archives = isset($related_post_settings['archives']) ? $related_post_settings['archives'] : array();
37
38 $archives_array = array('front_page' => __('Front page', 'related-post'), 'home' => __('Home', 'related-post'), 'blog' => __('Blog', 'related-post'), 'author' => __('Author ', 'related-post'), 'search' => __('Search', 'related-post'), 'year' => __('Year', 'related-post'), 'month' => __('Month', 'related-post'), 'date' => __('Date', 'related-post'));
39 $all_post_types = get_post_types();
40 $taxonomies = get_object_taxonomies($all_post_types);
41
42
43 foreach ($taxonomies as $taxonomy) {
44 $the_taxonomy = get_taxonomy($taxonomy);
45
46 $archives_array[$taxonomy] = $the_taxonomy->labels->name;
47 }
48
49
50
51 // echo '<pre>'.var_export($related_post_settings, true).'</pre>';
52
53 ?>
54 <div class="section">
55 <div class="section-title"><?php esc_html_e('General settings', 'related-post'); ?></div>
56 <p class="description section-description"><?php esc_html_e('Choose some general option to getting started.', 'related-post'); ?></p>
57
58 <?php
59
60
61 $post_types_list = get_post_types('', 'names');
62 $post_types_array = array();
63
64 foreach ($post_types_list as $post_type) {
65
66 $obj = get_post_type_object($post_type);
67 $singular_name = $obj->labels->singular_name;
68 $post_types_array[$post_type] = $singular_name;
69 }
70
71 //echo '<pre>'.var_export($post_types_array, true).'</pre>';
72
73
74
75
76
77 ob_start();
78
79
80 ?>
81 <div class="templates_editor expandable">
82 <?php
83
84 //$post_types = apply_filters('wishlist_posttypes', array('post'=>'Post', 'page' => 'Page'));
85 //$post_types = $post_types_list;....
86
87
88 //var_dump($post_types_list);
89
90 unset($post_types_list['nav_menu_item']);
91 unset($post_types_list['custom_css']);
92 unset($post_types_list['customize_changeset']);
93 unset($post_types_list['oembed_cache']);
94 unset($post_types_list['user_request']);
95 unset($post_types_list['wp_block']);
96 unset($post_types_list['revision']);
97
98
99
100
101 if (!empty($post_types_list))
102 foreach ($post_types_list as $post_type => $post_name) {
103
104
105 $enable = isset($post_types_display[$post_type]['enable']) ? $post_types_display[$post_type]['enable'] : 'no';
106 $content_position = isset($post_types_display[$post_type]['content_position']) ? $post_types_display[$post_type]['content_position'] : array();
107 $excerpt_position = isset($post_types_display[$post_type]['excerpt_position']) ? $post_types_display[$post_type]['excerpt_position'] : array();
108 $comment_form_position = isset($post_types_display[$post_type]['comment_form_position']) ? $post_types_display[$post_type]['comment_form_position'] : array();
109 $inclued_taxonomies = isset($post_types_display[$post_type]['inclued_taxonomies']) ? $post_types_display[$post_type]['inclued_taxonomies'] : array();
110 $tax_realtion = isset($post_types_display[$post_type]['tax_realtion']) ? $post_types_display[$post_type]['tax_realtion'] : 'OR';
111 $manual_post = isset($post_types_display[$post_type]['manual_post']) ? $post_types_display[$post_type]['manual_post'] : 'no';
112 $only_manual_post = isset($post_types_display[$post_type]['only_manual_post']) ? $post_types_display[$post_type]['only_manual_post'] : 'no';
113
114
115
116 $description = isset($post_types_display[$post_type]['description']) ? $post_types_display[$post_type]['description'] : '';
117
118
119 $paragraph_positions = isset($post_types_display[$post_type]['paragraph_positions']) ? $post_types_display[$post_type]['paragraph_positions'] : '';
120 $view_type = isset($post_types_display[$post_type]['view_type']) ? $post_types_display[$post_type]['view_type'] : '';
121 $headline_text = isset($post_types_display[$post_type]['headline_text']) ? $post_types_display[$post_type]['headline_text'] : __('Related Posts', 'related-post');
122
123 $posttype_taxonomies = get_object_taxonomies($post_type);
124 $taxArgs = [];
125 foreach ($posttype_taxonomies as $tax) {
126 $taxArgs[$tax] = $tax;
127 }
128
129 //echo '<pre>' . var_export($inclued_taxonomies) . '</pre>';
130
131 //echo '<pre>' . var_export($posttype_taxonomies) . '</pre>';
132
133 ?>
134 <div class="item template <?php //echo $post_type;
135 ?>">
136 <div class="header">
137
138 <?php
139 if ($enable == 'yes') :
140 ?>
141 <span title="<?php esc_html_e('Enable', 'related-post'); ?>" class="is-enable ">
142 <i class="fa fa-check-square"></i>
143 </span>
144 <?php
145 else :
146 ?>
147 <span title="<?php esc_html_e('Disabled', 'related-post'); ?>" class="is-enable ">
148 <i class="fa fa-times-circle"></i>
149 </span>
150 <?php
151 endif;
152 ?>
153 <span title="<?php esc_html_e('Click to expand', 'related-post'); ?>" class="expand ">
154 <?php echo esc_html($post_name); ?>
155 </span>
156
157
158 </div>
159 <input type="hidden" name="related_post_settings[post_types_display][<?php echo esc_attr($post_type); ?>][name]" value="<?php echo esc_attr($post_type); ?>" />
160 <div class="options">
161 <div class="description"><?php echo esc_html($description); ?></div><br /><br />
162
163 <?php
164
165 $args = array(
166 'id' => 'enable',
167 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
168 'title' => __('Enable?', 'related-post'),
169 /* translators: %s: Post Type */
170 'details' => sprintf(__('Enable or disable related post automatically for %s.', 'related-post'), $post_type),
171 'type' => 'select',
172 'value' => $enable,
173 'default' => 'no',
174 'style' => array('inline' => true),
175 'args' => array('yes' => 'Yes', 'no' => 'No'),
176
177 );
178
179 $settings_tabs_field->generate_field($args);
180
181
182 $args = array(
183 'id' => 'content_position',
184 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
185 'title' => __('Content positions', 'related-post'),
186 'details' => __('Display before or after content.', 'related-post'),
187 'type' => 'checkbox',
188 'value' => $content_position,
189 'default' => [],
190 'style' => array('inline' => true),
191 'args' => array('before' => 'Before', 'after' => 'After'),
192
193 );
194
195 $settings_tabs_field->generate_field($args);
196
197 $args = array(
198 'id' => 'excerpt_position',
199 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
200 'title' => __('Excerpt positions', 'related-post'),
201 'details' => __('Display before or after excerpt.', 'related-post'),
202 'type' => 'checkbox',
203 'value' => $excerpt_position,
204 'default' => [],
205 'style' => array('inline' => true),
206 'args' => array('before' => 'Before', 'after' => 'After'),
207
208 );
209
210 $settings_tabs_field->generate_field($args);
211
212
213 $args = array(
214 'id' => 'comment_form_position',
215 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
216 'title' => __('Comment form positions', 'related-post'),
217 'details' => __('Display before or after excerpt.', 'related-post'),
218 'type' => 'checkbox',
219 'value' => $comment_form_position,
220 'default' => [],
221 'style' => array('inline' => true),
222 'args' => array('before' => 'Before', 'after' => 'After'),
223
224 );
225
226 $settings_tabs_field->generate_field($args);
227
228
229
230 $args = array(
231 'id' => 'inclued_taxonomies',
232 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
233 'title' => __('Include taxonomies', 'related-post'),
234 'details' => __('Query from only these taxonomies.', 'related-post'),
235 'type' => 'checkbox',
236 'value' => $inclued_taxonomies,
237 'default' => array(),
238 'style' => array('inline' => true),
239 'args' => $taxArgs,
240
241 );
242
243 $settings_tabs_field->generate_field($args);
244
245
246 $args = array(
247 'id' => 'tax_realtion',
248 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
249 'title' => __('Taxonomy relation', 'related-post'),
250 'details' => __('Choose Taxonomy relation.', 'related-post'),
251 'type' => 'select',
252 'value' => $tax_realtion,
253 'default' => array('OR'),
254 'style' => array('inline' => true),
255 'args' => array('OR' => 'OR', 'AND' => 'AND'),
256
257 );
258
259 $settings_tabs_field->generate_field($args);
260
261
262
263
264 $args = array(
265 'id' => 'view_type',
266 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
267 'title' => __('View type', 'related-post'),
268 'details' => __('Choose view type.', 'related-post'),
269 'type' => 'select',
270 'value' => $view_type,
271 'default' => array(),
272 'style' => array('inline' => true),
273 'args' => array('grid' => 'Grid', 'slider' => 'Slider'),
274
275 );
276
277 $settings_tabs_field->generate_field($args);
278
279
280 $args = array(
281 'id' => 'paragraph_positions',
282 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
283 'title' => __('Paragraph positions', 'related-post'),
284 'details' => __('Display related post after n\'th paragraph. N is total paragraph count, use comma to separate.', 'related-post'),
285 'type' => 'text',
286 'value' => $paragraph_positions,
287 'default' => '',
288 'placeholder' => '1,2,N-1',
289 );
290
291 $settings_tabs_field->generate_field($args);
292
293
294
295 $args = array(
296 'id' => 'headline_text',
297 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
298 'title' => __('Headline text', 'related-post'),
299 'details' => __('Custom text for related post headline..', 'related-post'),
300 'type' => 'text',
301 'value' => $headline_text,
302 'default' => '',
303 'placeholder' => '',
304 );
305
306 $settings_tabs_field->generate_field($args);
307
308
309 $args = array(
310 'id' => 'manual_post',
311 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
312 'title' => __('Manual Post Selection', 'related-post'),
313 'details' => __('Enable manual post selection for this post type.', 'related-post'),
314 'type' => 'select',
315 'value' => $manual_post,
316 'default' => array('no'),
317 'style' => array('inline' => true),
318 'args' => array('yes' => 'Yes', 'no' => 'No'),
319
320 );
321
322 $settings_tabs_field->generate_field($args);
323
324
325 $active_plugins = get_option('active_plugins');
326 if (in_array('related-post-pro/related-post-pro.php', (array) $active_plugins)) {
327
328
329 $args = array(
330 'id' => 'only_manual_post',
331 'parent' => 'related_post_settings[post_types_display][' . $post_type . ']',
332 'title' => __('Show only manual posts', 'related-post'),
333 'details' => __('Enable to display only manyally selected posts.', 'related-post'),
334 'type' => 'select',
335 'value' => $only_manual_post,
336 'default' => array('no'),
337 'style' => array('inline' => true),
338 'args' => array('yes' => 'Yes', 'no' => 'No'),
339
340 );
341
342 $settings_tabs_field->generate_field($args);
343 }
344
345
346
347
348
349
350 ?>
351
352
353 </div>
354
355 </div>
356 <?php
357
358 }
359
360
361 ?>
362
363
364 </div>
365 <?php
366
367
368 $html = ob_get_clean();
369
370
371
372
373 $args = array(
374 'id' => 'post_types',
375 //'parent' => '',
376 'title' => __('Post types display', 'related-post'),
377 'details' => __('Display automatically wishlist under following post types content and excerpt.', 'related-post'),
378 'type' => 'custom_html',
379 //'multiple' => true,
380 'html' => $html,
381 );
382
383 $settings_tabs_field->generate_field($args);
384
385
386
387 $args = array(
388 'id' => 'headline_text_style',
389 'title' => __('Headline text style', 'related-post'),
390 'details' => __('Customize headline text.', 'related-post'),
391 'type' => 'option_group',
392 'options' => array(
393 array(
394 'id' => 'font_size',
395 'parent' => 'related_post_settings[headline_text_style]',
396 'title' => __('Font size', 'related-post'),
397 'details' => __('Set custom font size, ex: 18px', 'related-post'),
398 'type' => 'text',
399 'value' => $headline_text_font_size,
400 'default' => '18px',
401 'placeholder' => '18px',
402 ),
403
404 array(
405 'id' => 'color',
406 'parent' => 'related_post_settings[headline_text_style]',
407 'title' => __('Color', 'related-post'),
408 'details' => __('Set custom font color, ex: 18px', 'related-post'),
409 'type' => 'colorpicker',
410 'value' => $headline_text_color,
411 'default' => '#999999',
412 'placeholder' => '#999999',
413 ),
414
415 array(
416 'id' => 'custom_css',
417 'parent' => 'related_post_settings[headline_text_style]',
418 'title' => __('Custom CSS', 'related-post'),
419 'details' => __('Set custom css, do not use &lt;style>&lt;/style> tag,use <strong>!important</strong> to override.', 'related-post'),
420 'type' => 'textarea',
421 'value' => $headline_text_custom_css,
422 'default' => '',
423 'placeholder' => '.related-post .headline{
424 border:1px solid #999;
425 }',
426 ),
427 array(
428 'id' => 'tag',
429 'parent' => 'related_post_settings[headline_text_style]',
430 'title' => __('Custom tag for headeline text', 'related-post'),
431 'details' => __('Set custom tag, ex: h1, h2', 'related-post'),
432 'type' => 'text',
433 'value' => $headline_text_tag,
434 'default' => 'div',
435 'placeholder' => '',
436 ),
437
438
439 ),
440
441 );
442
443 $settings_tabs_field->generate_field($args);
444
445
446
447 ?>
448
449
450 </div>
451 <?php
452
453
454 }
455 }
456
457
458 add_action('related_post_settings_content_style', 'related_post_settings_content_style');
459
460 if (!function_exists('related_post_settings_content_style')) {
461 function related_post_settings_content_style($tab)
462 {
463
464 $settings_tabs_field = new settings_tabs_field();
465
466 $related_post_settings = get_option('related_post_settings');
467
468 $layout_type = isset($related_post_settings['layout_type']) ? $related_post_settings['layout_type'] : 'grid';
469 $grid_item_margin = isset($related_post_settings['grid_item_margin']) ? $related_post_settings['grid_item_margin'] : '10px';
470 $grid_item_padding = isset($related_post_settings['grid_item_padding']) ? $related_post_settings['grid_item_padding'] : '0px';
471 $grid_item_align = isset($related_post_settings['grid_item_align']) ? $related_post_settings['grid_item_align'] : 'left';
472 $font_aw_version = isset($related_post_settings['font_aw_version']) ? $related_post_settings['font_aw_version'] : 'none';
473
474 $item_width_large = isset($related_post_settings['item_width']['large']) ? $related_post_settings['item_width']['large'] : '45%';
475 $item_width_medium = isset($related_post_settings['item_width']['medium']) ? $related_post_settings['item_width']['medium'] : '90%';
476 $item_width_small = isset($related_post_settings['item_width']['small']) ? $related_post_settings['item_width']['small'] : '90%';
477
478 //echo '<pre>'.var_export($related_post_settings, true).'</pre>';
479 //delete_option('related_post_settings');
480 ?>
481 <div class="section">
482 <div class="section-title"><?php esc_html_e('Style settings', 'related-post'); ?></div>
483 <p class="description section-description"><?php esc_html_e('Choose & customize style settings.', 'related-post'); ?></p>
484
485 <?php
486
487 $args = array(
488 'id' => 'layout_type',
489 'parent' => 'related_post_settings',
490 'title' => __('Layout type', 'related-post'),
491 'details' => __('Choose layout type.', 'related-post'),
492 'type' => 'select',
493 'value' => $layout_type,
494 'default' => 'grid',
495 'args' => array('grid' => __('Grid', 'related-post'), 'slider' => __('Slider', 'related-post')),
496 );
497
498 $settings_tabs_field->generate_field($args);
499
500
501
502
503
504 $args = array(
505 'id' => 'item_width',
506 'title' => __('Item width', 'related-post'),
507 'details' => __('Set item width.', 'related-post'),
508 'type' => 'option_group',
509 'options' => array(
510 array(
511 'id' => 'large',
512 'parent' => 'related_post_settings[item_width]',
513 'title' => __('In desktop', 'related-post'),
514 'details' => __('min-width: 1200px, ex: 45% or 280px', 'related-post'),
515 'type' => 'text',
516 'value' => $item_width_large,
517 'default' => '45%',
518 'placeholder' => '45%',
519 ),
520 array(
521 'id' => 'medium',
522 'parent' => 'related_post_settings[item_width]',
523 'title' => __('In tablet & small desktop', 'related-post'),
524 'details' => __('min-width: 992px, ex: 90% or 280px', 'related-post'),
525 'type' => 'text',
526 'value' => $item_width_medium,
527 'default' => '90%',
528 'placeholder' => '90%',
529 ),
530 array(
531 'id' => 'small',
532 'parent' => 'related_post_settings[item_width]',
533 'title' => __('In mobile', 'related-post'),
534 'details' => __('max-width: 768px, ex: 90% or 280px', 'related-post'),
535 'type' => 'text',
536 'value' => $item_width_small,
537 'default' => '90%',
538 'placeholder' => '90%',
539 ),
540 ),
541
542 );
543
544 $settings_tabs_field->generate_field($args);
545
546
547
548
549
550
551
552
553
554 $args = array(
555 'id' => 'grid_item_margin',
556 'parent' => 'related_post_settings',
557 'title' => __('Item margin', 'related-post'),
558 'details' => __('Set item margin. ex: 5px 10px', 'related-post'),
559 'type' => 'text',
560 'value' => $grid_item_margin,
561 'default' => '5px',
562 'placeholder' => '5px 10px',
563 );
564
565 $settings_tabs_field->generate_field($args);
566
567 $args = array(
568 'id' => 'grid_item_padding',
569 'parent' => 'related_post_settings',
570 'title' => __('Item padding', 'related-post'),
571 'details' => __('Set item padding. ex: 5px 10px', 'related-post'),
572 'type' => 'text',
573 'value' => $grid_item_padding,
574 'default' => '0px',
575 'placeholder' => '5px 10px',
576 );
577
578 $settings_tabs_field->generate_field($args);
579
580 $args = array(
581 'id' => 'grid_item_align',
582 'parent' => 'related_post_settings',
583 'title' => __('Item text align', 'related-post'),
584 'details' => __('Set item text align.', 'related-post'),
585 'type' => 'select',
586 'value' => $grid_item_align,
587 'default' => 'left',
588 'args' => array('left' => __('Left', 'related-post'), 'center' => __('Center', 'related-post'), 'right' => __('Right', 'related-post')),
589 );
590
591 $settings_tabs_field->generate_field($args);
592
593 $args = array(
594 'id' => 'font_aw_version',
595 'parent' => 'related_post_settings',
596 'title' => __('Font-awesome version', 'related-post'),
597 'details' => __('Choose font awesome version you want to load.', 'related-post'),
598 'type' => 'select',
599 'value' => $font_aw_version,
600 'default' => 'none',
601 'args' => array('v_5' => __('Version 5+', 'related-post'), 'v_4' => __('Version 4+', 'related-post'), 'none' => __('None', 'related-post')),
602 );
603
604 $settings_tabs_field->generate_field($args);
605
606
607 ?>
608
609
610 </div>
611 <?php
612
613
614 }
615 }
616
617
618 add_action('related_post_settings_content_query', 'related_post_settings_content_query');
619
620 if (!function_exists('related_post_settings_content_query')) {
621 function related_post_settings_content_query($tab)
622 {
623
624 $settings_tabs_field = new settings_tabs_field();
625
626 $related_post_settings = get_option('related_post_settings');
627
628 $orderby = isset($related_post_settings['orderby']) ? $related_post_settings['orderby'] : array('post__in');
629 $order = isset($related_post_settings['order']) ? $related_post_settings['order'] : 'DESC';
630 $max_post_count = isset($related_post_settings['max_post_count']) ? $related_post_settings['max_post_count'] : 4;
631
632 //echo '<pre>'.var_export($display_auto, true).'</pre>';
633 //delete_option('related_post_settings');
634 ?>
635 <div class="section">
636 <div class="section-title"><?php esc_html_e('Post query settings', 'related-post'); ?></div>
637 <p class="description section-description"><?php esc_html_e('Choose post query settings.', 'related-post'); ?></p>
638
639 <?php
640
641 $args = array(
642 'id' => 'orderby',
643 'parent' => 'related_post_settings',
644 'title' => __('Query orderby', 'related-post'),
645 'details' => __('Choose related post query orderby, this will override by <code>post__in</code> if manually selected post is not empty.', 'related-post'),
646 'type' => 'select',
647 'value' => $orderby,
648 'multiple' => true,
649 'default' => array('post__in'),
650 'args' => array(
651 'ID' => __('ID', 'related-post'),
652 'date' => __('Date', 'related-post'),
653 'rand' => __('Random', 'related-post'),
654 'comment_count' => __('Comment count', 'related-post'),
655 'author' => __('Author', 'related-post'),
656 'title' => __('Title', 'related-post'),
657 'name' => __('Name', 'related-post'),
658 'type' => __('Type', 'related-post'),
659 'menu_order' => __('Menu order', 'related-post'),
660 'post__in' => __('post__in', 'related-post'),
661
662 ),
663 );
664
665 $settings_tabs_field->generate_field($args);
666
667 $args = array(
668 'id' => 'order',
669 'parent' => 'related_post_settings',
670 'title' => __('Post order', 'related-post'),
671 'details' => __('Choose post query order.', 'related-post'),
672 'type' => 'select',
673 'value' => $order,
674 'default' => 'DESC',
675 'args' => array('DESC' => __('Descending', 'related-post'), 'ASC' => __('Ascending', 'related-post')),
676 );
677
678 $settings_tabs_field->generate_field($args);
679
680
681
682 $args = array(
683 'id' => 'max_post_count',
684 'parent' => 'related_post_settings',
685 'title' => __('Max number of post', 'related-post'),
686 'details' => __('Maximum number of post to display.', 'related-post'),
687 'type' => 'text',
688 'value' => $max_post_count,
689 'default' => '5',
690 );
691
692 $settings_tabs_field->generate_field($args);
693
694
695
696
697
698
699
700
701 ?>
702
703
704 </div>
705 <?php
706
707
708 }
709 }
710
711
712 add_action('related_post_settings_content_elements', 'related_post_settings_content_elements');
713
714 if (!function_exists('related_post_settings_content_elements')) {
715 function related_post_settings_content_elements($tab)
716 {
717
718 $settings_tabs_field = new settings_tabs_field();
719
720 $related_post_settings = get_option('related_post_settings');
721
722
723 $elements = isset($related_post_settings['elements']) ? $related_post_settings['elements'] : array();
724 $elements_index = isset($related_post_settings['elements_index']) ? $related_post_settings['elements_index'] : array();
725
726
727
728 //$layout_items= $related_post_settings['layout_items'];
729
730 //delete_option('related_post_settings');
731 //echo '<pre>'.var_export($get_intermediate_image_sizes, true).'</pre>';
732
733 ?>
734 <div class="section">
735 <div class="section-title"><?php esc_html_e('Elements', 'related-post'); ?></div>
736 <p class="description section-description"><?php esc_html_e('Customize post elements.', 'related-post'); ?></p>
737
738 <?php
739 $get_intermediate_image_sizes = get_intermediate_image_sizes();
740 $get_intermediate_image_sizes[] = 'full';
741
742
743 $image_sizes = array();
744 foreach ($get_intermediate_image_sizes as $size) {
745 $image_sizes[$size] = ucfirst($size);
746 }
747
748
749 //$wp_get_additional_image_sizes = wp_get_additional_image_sizes();
750
751 //$get_intermediate_image_sizes = array_merge($get_intermediate_image_sizes,array('full'));
752 //echo '<pre>'.var_export($wp_get_additional_image_sizes, true).'</pre>';
753
754 $args = array(
755 'id' => 'elements',
756 'title' => __('Elements settings', 'related-post'),
757 'details' => __('Customize elements.', 'related-post'),
758 'type' => 'option_group_accordion',
759 'value' => $elements,
760 'sortable' => true,
761 'default' => array(),
762 'args_index' => $elements_index,
763 'args_index_default' => apply_filters('related_post_elements_index', array('post_title', 'post_thumb', 'post_excerpt')),
764 'args_index_hide' => array('post_title' => false, 'post_thumb' => false, 'post_excerpt' => false),
765
766 'args' => apply_filters(
767 'related_post_elements_args',
768 array(
769 'post_title' => array(
770 'title' => 'Post title',
771 'options' => array(
772 array(
773 'id' => 'post_title',
774 'parent' => 'related_post_settings[elements_index]',
775 'title' => '',
776 'details' => '',
777 'type' => 'hidden',
778 'value' => 'post_title',
779 'default' => 'post_title',
780 ),
781 array(
782 'id' => 'hide',
783 'parent' => 'related_post_settings[elements][post_title]',
784 'title' => __('Hide', 'related-post'),
785 'details' => __('You can hide this element.', 'related-post'),
786 'type' => 'select',
787 'value' => isset($elements['post_title']['hide']) ? $elements['post_title']['hide'] : 'no',
788 //'multiple' => true,
789 'default' => 'no',
790 'args' => array(
791 'no' => __('No', 'related-post'),
792 'yes' => __('Yes', 'related-post'),
793 ),
794 ),
795
796 array(
797 'id' => 'font_size',
798 'parent' => 'related_post_settings[elements][post_title]',
799 'title' => __('Font size', 'related-post'),
800 'details' => __('Set custom font size. ex: 14px', 'related-post'),
801 'type' => 'text',
802 'value' => isset($elements['post_title']['font_size']) ? $elements['post_title']['font_size'] : '',
803 'default' => '16px',
804 'placeholder' => '14px',
805 ),
806 array(
807 'id' => 'font_color',
808 'css_id' => 'post_title_font_color',
809 'parent' => 'related_post_settings[elements][post_title]',
810 'title' => __('Font color', 'related-post'),
811 'details' => __('Choose font color.', 'related-post'),
812 'type' => 'colorpicker',
813 'value' => isset($elements['post_title']['font_color']) ? $elements['post_title']['font_color'] : '',
814 'default' => '#3f3f3f',
815 'placeholder' => '14px',
816 ),
817 array(
818 'id' => 'line_height',
819 'parent' => 'related_post_settings[elements][post_title]',
820 'title' => __('Line height', 'related-post'),
821 'details' => __('Set line height.', 'related-post'),
822 'type' => 'text',
823 'value' => isset($elements['post_title']['line_height']) ? $elements['post_title']['line_height'] : '',
824 'default' => '',
825 'placeholder' => 'normal',
826 ),
827
828 array(
829 'id' => 'margin',
830 'parent' => 'related_post_settings[elements][post_title]',
831 'title' => __('Margin', 'related-post'),
832 'details' => __('Set margin. ex: 5px 10px', 'related-post'),
833 'type' => 'text',
834 'value' => isset($elements['post_title']['margin']) ? $elements['post_title']['margin'] : '',
835 'default' => '10px 0px',
836 'placeholder' => '10px',
837 ),
838
839 array(
840 'id' => 'padding',
841 'parent' => 'related_post_settings[elements][post_title]',
842 'title' => __('Padding', 'related-post'),
843 'details' => __('Set padding. ex: 5px 10px', 'related-post'),
844 'type' => 'text',
845 'value' => isset($elements['post_title']['padding']) ? $elements['post_title']['padding'] : '',
846 'default' => '0px',
847 'placeholder' => '10px',
848 ),
849 array(
850 'id' => 'icon',
851 'parent' => 'related_post_settings[elements][post_title]',
852 'title' => __('Icon', 'related-post'),
853 'details' => __('Set icon. use font awesome icon HTML, ex: <code>&lt;i class="fas fa-dot-circle">&lt;/i></code>', 'related-post'),
854 'type' => 'text',
855 'value' => isset($elements['post_title']['icon']) ? $elements['post_title']['icon'] : '',
856 'default' => '',
857 'placeholder' => esc_attr('<i class="fas fa-dot-circle"></i>'),
858 ),
859 array(
860 'id' => 'icon_font_size',
861 'parent' => 'related_post_settings[elements][post_title]',
862 'title' => __('Icon font size', 'related-post'),
863 'details' => __('Set icon font size.', 'related-post'),
864 'type' => 'text',
865 'value' => isset($elements['post_title']['icon_font_size']) ? $elements['post_title']['icon_font_size'] : '',
866 'default' => '',
867 'placeholder' => '16px',
868 ),
869 array(
870 'id' => 'custom_css',
871 'parent' => 'related_post_settings[elements][post_title]',
872 'title' => __('Custom CSS', 'related-post'),
873 'details' => __('Write custom CSS, do not write &lt;style>&lt;/style> tag, do not use selector(.class-name{})', 'related-post'),
874 'type' => 'textarea',
875 'value' => isset($elements['post_title']['custom_css']) ? $elements['post_title']['custom_css'] : '',
876 'placeholder' => 'color:#999999;',
877 ),
878
879
880
881
882
883 ),
884 ),
885 'post_thumb' => array(
886 'title' => 'Post thumbnail',
887 'options' => array(
888 array(
889 'id' => 'post_thumb',
890 'parent' => 'related_post_settings[elements_index]',
891 'title' => '',
892 'details' => '',
893 'type' => 'hidden',
894 'value' => 'post_thumb',
895 'default' => 'post_thumb',
896 ),
897 array(
898 'id' => 'hide',
899 'parent' => 'related_post_settings[elements][post_thumb]',
900 'title' => __('Hide', 'related-post'),
901 'details' => __('You can hide this element.', 'related-post'),
902 'type' => 'select',
903 'value' => isset($elements['post_thumb']['hide']) ? $elements['post_thumb']['hide'] : 'no',
904 //'multiple' => true,
905 'default' => 'no',
906 'args' => array(
907 'no' => __('No', 'related-post'),
908 'yes' => __('Yes', 'related-post'),
909 ),
910 ),
911
912 array(
913 'id' => 'thumb_size',
914 'parent' => 'related_post_settings[elements][post_thumb]',
915 'title' => __('Thumbnail size', 'related-post'),
916 'details' => __('Choose thumbnail size', 'related-post'),
917 'type' => 'select',
918 'value' => isset($elements['post_thumb']['thumb_size']) ? $elements['post_thumb']['thumb_size'] : 'full',
919 'default' => 'full',
920 'args' => $image_sizes,
921 ),
922 array(
923 'id' => 'default_img',
924 'parent' => 'related_post_settings[elements][post_thumb]',
925 'title' => __('Default thumbnail', 'related-post'),
926 'details' => __('Set default thumbnail', 'related-post'),
927 'type' => 'media_url',
928 'value' => isset($elements['post_thumb']['default_img']) ? $elements['post_thumb']['default_img'] : '',
929 'default' => '',
930 ),
931
932 array(
933 'id' => 'max_height',
934 'parent' => 'related_post_settings[elements][post_thumb]',
935 'title' => __('Max height', 'related-post'),
936 'details' => __('Set max height', 'related-post'),
937 'type' => 'text',
938 'value' => isset($elements['post_thumb']['max_height']) ? $elements['post_thumb']['max_height'] : '',
939 'default' => '220px',
940 'placeholder' => '200px',
941 ),
942 array(
943 'id' => 'margin',
944 'parent' => 'related_post_settings[elements][post_thumb]',
945 'title' => __('Margin', 'related-post'),
946 'details' => __('Set margin. ex: 5px 10px', 'related-post'),
947 'type' => 'text',
948 'value' => isset($elements['post_thumb']['margin']) ? $elements['post_thumb']['margin'] : '',
949 'default' => '10px 0px',
950 'placeholder' => '10px',
951 ),
952
953 array(
954 'id' => 'padding',
955 'parent' => 'related_post_settings[elements][post_thumb]',
956 'title' => __('Padding', 'related-post'),
957 'details' => __('Set padding. ex: 5px 10px', 'related-post'),
958 'type' => 'text',
959 'value' => isset($elements['post_thumb']['padding']) ? $elements['post_thumb']['padding'] : '',
960 'default' => '0px',
961 'placeholder' => '10px',
962 ),
963 array(
964 'id' => 'custom_css',
965 'parent' => 'related_post_settings[elements][post_thumb]',
966 'title' => __('Custom CSS', 'related-post'),
967 'details' => __('Write custom CSS, do not write &lt;style>&lt;/style> tag, do not use selector(.class-name{})', 'related-post'),
968 'type' => 'textarea',
969 'value' => isset($elements['post_thumb']['custom_css']) ? $elements['post_thumb']['custom_css'] : '',
970 'placeholder' => 'font-size:16px;',
971 ),
972
973 ),
974 ),
975 'post_excerpt' => array(
976 'title' => 'Post excerpt',
977 'options' => array(
978 array(
979 'id' => 'post_excerpt',
980 'parent' => 'related_post_settings[elements_index]',
981 'title' => '',
982 'details' => '',
983 'type' => 'hidden',
984 'value' => 'post_excerpt',
985 'default' => 'post_excerpt',
986 ),
987 array(
988 'id' => 'hide',
989 'parent' => 'related_post_settings[elements][post_excerpt]',
990 'title' => __('Hide', 'related-post'),
991 'details' => __('You can hide this element.', 'related-post'),
992 'type' => 'select',
993 'value' => isset($elements['post_excerpt']['hide']) ? $elements['post_excerpt']['hide'] : 'no',
994 //'multiple' => true,
995 'default' => 'no',
996 'args' => array(
997 'no' => __('No', 'related-post'),
998 'yes' => __('Yes', 'related-post'),
999 ),
1000 ),
1001 array(
1002 'id' => 'word_count',
1003 'parent' => 'related_post_settings[elements][post_excerpt]',
1004 'title' => __('Excerpt word count', 'related-post'),
1005 'details' => __('Set custom number of word count for excerpt.', 'related-post'),
1006 'type' => 'text',
1007 'value' => isset($elements['post_excerpt']['word_count']) ? $elements['post_excerpt']['word_count'] : '',
1008 'default' => '20',
1009 'placeholder' => '20',
1010 ),
1011
1012 array(
1013 'id' => 'read_more_text',
1014 'parent' => 'related_post_settings[elements][post_excerpt]',
1015 'title' => __('Read more text', 'related-post'),
1016 'details' => __('Set custom raed more text for excerpt.', 'related-post'),
1017 'type' => 'text',
1018 'value' => isset($elements['post_excerpt']['read_more_text']) ? $elements['post_excerpt']['read_more_text'] : '',
1019 'default' => __('Read more', 'related-post'),
1020 'placeholder' => __('Read more', 'related-post'),
1021 ),
1022
1023
1024 array(
1025 'id' => 'font_size',
1026 'parent' => 'related_post_settings[elements][post_excerpt]',
1027 'title' => __('Font size', 'related-post'),
1028 'details' => __('Set custom font size. ex: 14px', 'related-post'),
1029 'type' => 'text',
1030 'value' => isset($elements['post_excerpt']['font_size']) ? $elements['post_excerpt']['font_size'] : '',
1031 'default' => '13px',
1032 'placeholder' => '14px',
1033 ),
1034 array(
1035 'id' => 'font_color',
1036 'css_id' => 'excerpt_font_color',
1037 'parent' => 'related_post_settings[elements][post_excerpt]',
1038 'title' => __('Font color', 'related-post'),
1039 'details' => __('Choose font color.', 'related-post'),
1040 'type' => 'colorpicker',
1041 'value' => isset($elements['post_excerpt']['font_color']) ? $elements['post_excerpt']['font_color'] : '',
1042 'default' => '#3f3f3f',
1043 'placeholder' => '14px',
1044 ),
1045 array(
1046 'id' => 'line_height',
1047 'parent' => 'related_post_settings[elements][post_excerpt]',
1048 'title' => __('Line height', 'related-post'),
1049 'details' => __('Set line height.', 'related-post'),
1050 'type' => 'text',
1051 'value' => isset($elements['post_excerpt']['line_height']) ? $elements['post_excerpt']['line_height'] : '',
1052 'default' => '',
1053 'placeholder' => 'normal',
1054 ),
1055
1056 array(
1057 'id' => 'margin',
1058 'parent' => 'related_post_settings[elements][post_excerpt]',
1059 'title' => __('Margin', 'related-post'),
1060 'details' => __('Set margin. ex: 5px 10px', 'related-post'),
1061 'type' => 'text',
1062 'value' => isset($elements['post_excerpt']['margin']) ? $elements['post_excerpt']['margin'] : '',
1063 'default' => '10px 0px',
1064 'placeholder' => '10px',
1065 ),
1066
1067 array(
1068 'id' => 'padding',
1069 'parent' => 'related_post_settings[elements][post_excerpt]',
1070 'title' => __('Padding', 'related-post'),
1071 'details' => __('Set padding. ex: 5px 10px', 'related-post'),
1072 'type' => 'text',
1073 'value' => isset($elements['post_excerpt']['padding']) ? $elements['post_excerpt']['padding'] : '',
1074 'default' => '0px',
1075 'placeholder' => '10px',
1076 ),
1077 array(
1078 'id' => 'custom_css',
1079 'parent' => 'related_post_settings[elements][post_excerpt]',
1080 'title' => __('Custom CSS', 'related-post'),
1081 'details' => __('Write custom CSS, do not write &lt;style>&lt;/style> tag, do not use selector(.class-name{})', 'related-post'),
1082 'type' => 'textarea',
1083 'value' => isset($elements['post_excerpt']['custom_css']) ? $elements['post_excerpt']['custom_css'] : '',
1084 'placeholder' => 'border: 1px solid #ddddd;',
1085 ),
1086
1087
1088
1089 ),
1090 ),
1091
1092 ),
1093 $elements
1094 ),
1095 );
1096
1097 $settings_tabs_field->generate_field($args);
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107 ?>
1108
1109
1110 </div>
1111 <?php
1112
1113
1114 }
1115 }
1116 add_action('related_post_settings_content_slider', 'related_post_settings_content_slider');
1117
1118 if (!function_exists('related_post_settings_content_slider')) {
1119 function related_post_settings_content_slider($tab)
1120 {
1121
1122 $settings_tabs_field = new settings_tabs_field();
1123
1124 $related_post_settings = get_option('related_post_settings');
1125 $slider_column_number_desktop = isset($related_post_settings['slider']['column_desktop']) ? $related_post_settings['slider']['column_desktop'] : 3;
1126 $slider_column_number_tablet = isset($related_post_settings['slider']['column_tablet']) ? $related_post_settings['slider']['column_tablet'] : 2;
1127 $slider_column_number_mobile = isset($related_post_settings['slider']['column_mobile']) ? $related_post_settings['slider']['column_mobile'] : 1;
1128
1129 $slider_slide_speed = isset($related_post_settings['slider']['slide_speed']) ? $related_post_settings['slider']['slide_speed'] : 1000;
1130 $slider_pagination_speed = isset($related_post_settings['slider']['pagination_speed']) ? $related_post_settings['slider']['pagination_speed'] : 1200;
1131
1132
1133 $slider_auto_play = isset($related_post_settings['slider']['auto_play']) ? $related_post_settings['slider']['auto_play'] : 'true';
1134 $slider_rewind = isset($related_post_settings['slider']['rewind']) ? $related_post_settings['slider']['rewind'] : 'true';
1135 $slider_loop = isset($related_post_settings['slider']['loop']) ? $related_post_settings['slider']['loop'] : 'true';
1136 $slider_center = isset($related_post_settings['slider']['center']) ? $related_post_settings['slider']['center'] : 'true';
1137 $slider_stop_on_hover = isset($related_post_settings['slider']['stop_on_hover']) ? $related_post_settings['slider']['stop_on_hover'] : 'true';
1138 $slider_navigation = isset($related_post_settings['slider']['navigation']) ? $related_post_settings['slider']['navigation'] : 'true';
1139 $navigation_position = isset($related_post_settings['slider']['navigation_position']) ? $related_post_settings['slider']['navigation_position'] : '';
1140
1141 $slider_pagination = isset($related_post_settings['slider']['pagination']) ? $related_post_settings['slider']['pagination'] : 'true';
1142 $slider_pagination_count = isset($related_post_settings['slider']['pagination_count']) ? $related_post_settings['slider']['pagination_count'] : 'false';
1143 $slider_rtl = isset($related_post_settings['slider']['rtl']) ? $related_post_settings['slider']['rtl'] : 'false';
1144
1145 //echo '<pre>'.var_export($display_auto, true).'</pre>';
1146
1147 ?>
1148 <div class="section">
1149 <div class="section-title"><?php esc_html_e('Slider settings', 'related-post'); ?></div>
1150 <p class="description section-description"><?php esc_html_e('Choose slider settings.', 'related-post'); ?></p>
1151
1152 <?php
1153
1154 $args = array(
1155 'id' => 'slider',
1156 'title' => __('Slider column count ', 'related-post'),
1157 'details' => __('Set slider column count.', 'related-post'),
1158 'type' => 'option_group',
1159 'options' => array(
1160 array(
1161 'id' => 'column_desktop',
1162 'parent' => 'related_post_settings[slider]',
1163 'title' => __('In desktop', 'related-post'),
1164 'details' => __('min-width: 1200px, ex: 3', 'related-post'),
1165 'type' => 'text',
1166 'value' => $slider_column_number_desktop,
1167 'default' => 3,
1168 'placeholder' => '3',
1169 ),
1170 array(
1171 'id' => 'column_tablet',
1172 'parent' => 'related_post_settings[slider]',
1173 'title' => __('In tablet & small desktop', 'related-post'),
1174 'details' => __('min-width: 992px, ex: 2', 'related-post'),
1175 'type' => 'text',
1176 'value' => $slider_column_number_tablet,
1177 'default' => 2,
1178 'placeholder' => '2',
1179 ),
1180 array(
1181 'id' => 'column_mobile',
1182 'parent' => 'related_post_settings[slider]',
1183 'title' => __('In mobile', 'related-post'),
1184 'details' => __('min-width: 576px, ex: 1', 'related-post'),
1185 'type' => 'text',
1186 'value' => $slider_column_number_mobile,
1187 'default' => 1,
1188 'placeholder' => '1',
1189 ),
1190 ),
1191
1192 );
1193
1194 $settings_tabs_field->generate_field($args);
1195
1196
1197
1198
1199 $args = array(
1200 'id' => 'slide_speed',
1201 'parent' => 'related_post_settings[slider]',
1202 'title' => __('Navigation slide speed', 'related-post'),
1203 'details' => __('Set slide speed, ex: 1000', 'related-post'),
1204 'type' => 'text',
1205 'value' => $slider_slide_speed,
1206 'default' => 1000,
1207 'placeholder' => '1000',
1208 );
1209
1210 $settings_tabs_field->generate_field($args);
1211
1212 $args = array(
1213 'id' => 'pagination_speed',
1214 'parent' => 'related_post_settings[slider]',
1215 'title' => __('Dots slide speed', 'related-post'),
1216 'details' => __('Set dots slide speed, ex: 1200', 'related-post'),
1217 'type' => 'text',
1218 'value' => $slider_pagination_speed,
1219 'default' => 1200,
1220 'placeholder' => '1200',
1221 );
1222
1223 $settings_tabs_field->generate_field($args);
1224
1225
1226
1227 $args = array(
1228 'id' => 'auto_play',
1229 'parent' => 'related_post_settings[slider]',
1230 'title' => __('Auto play', 'related-post'),
1231 'details' => __('Choose slider auto play.', 'related-post'),
1232 'type' => 'select',
1233 'value' => $slider_auto_play,
1234 'default' => 'true',
1235 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1236 );
1237
1238 $settings_tabs_field->generate_field($args);
1239
1240 $args = array(
1241 'id' => 'rewind',
1242 'parent' => 'related_post_settings[slider]',
1243 'title' => __('Slider rewind', 'related-post'),
1244 'details' => __('Choose slider rewind.', 'related-post'),
1245 'type' => 'select',
1246 'value' => $slider_rewind,
1247 'default' => 'true',
1248 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1249 );
1250
1251 $settings_tabs_field->generate_field($args);
1252
1253 $args = array(
1254 'id' => 'loop',
1255 'parent' => 'related_post_settings[slider]',
1256 'title' => __('Slider loop', 'related-post'),
1257 'details' => __('Choose slider loop.', 'related-post'),
1258 'type' => 'select',
1259 'value' => $slider_loop,
1260 'default' => 'true',
1261 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1262 );
1263
1264 $settings_tabs_field->generate_field($args);
1265
1266
1267
1268 $args = array(
1269 'id' => 'center',
1270 'parent' => 'related_post_settings[slider]',
1271 'title' => __('Slider center', 'related-post'),
1272 'details' => __('Choose slider center.', 'related-post'),
1273 'type' => 'select',
1274 'value' => $slider_center,
1275 'default' => 'true',
1276 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1277 );
1278
1279 $settings_tabs_field->generate_field($args);
1280
1281 $args = array(
1282 'id' => 'stop_on_hover',
1283 'parent' => 'related_post_settings[slider]',
1284 'title' => __('Slider stop on hover', 'related-post'),
1285 'details' => __('Choose stop on hover.', 'related-post'),
1286 'type' => 'select',
1287 'value' => $slider_stop_on_hover,
1288 'default' => 'true',
1289 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1290 );
1291
1292 $settings_tabs_field->generate_field($args);
1293
1294
1295
1296
1297 $args = array(
1298 'id' => 'navigation',
1299 'parent' => 'related_post_settings[slider]',
1300 'title' => __('Slider navigation', 'related-post'),
1301 'details' => __('Choose slider navigation.', 'related-post'),
1302 'type' => 'select',
1303 'value' => $slider_navigation,
1304 'default' => 'true',
1305 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1306 );
1307
1308 $settings_tabs_field->generate_field($args);
1309
1310 $args = array(
1311 'id' => 'navigation_position',
1312 'parent' => 'related_post_settings[slider]',
1313 'title' => __('Slider navigation position', 'related-post'),
1314 'details' => __('Choose slider navigation position.', 'related-post'),
1315 'type' => 'select',
1316 'value' => $navigation_position,
1317 'default' => 'topright',
1318 'args' => array('topright' => __('Top-right', 'related-post'),), //'middle'=>__('Middle','related-post') , 'middle-fixed'=>__('Middle-fixed','related-post')
1319 );
1320
1321 $settings_tabs_field->generate_field($args);
1322
1323
1324
1325 $args = array(
1326 'id' => 'pagination',
1327 'parent' => 'related_post_settings[slider]',
1328 'title' => __('Slider pagination', 'related-post'),
1329 'details' => __('Choose slider pagination.', 'related-post'),
1330 'type' => 'select',
1331 'value' => $slider_pagination,
1332 'default' => 'true',
1333 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1334 );
1335
1336 $settings_tabs_field->generate_field($args);
1337
1338
1339 $args = array(
1340 'id' => 'pagination_count',
1341 'parent' => 'related_post_settings[slider]',
1342 'title' => __('Slider pagination count', 'related-post'),
1343 'details' => __('Choose slider pagination count.', 'related-post'),
1344 'type' => 'select',
1345 'value' => $slider_pagination_count,
1346 'default' => 'true',
1347 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1348 );
1349
1350 $settings_tabs_field->generate_field($args);
1351
1352 $args = array(
1353 'id' => 'rtl',
1354 'parent' => 'related_post_settings[slider]',
1355 'title' => __('Slider rtl', 'related-post'),
1356 'details' => __('Choose slider rtl.', 'related-post'),
1357 'type' => 'select',
1358 'value' => $slider_rtl,
1359 'default' => 'false',
1360 'args' => array('true' => __('True', 'related-post'), 'false' => __('False', 'related-post')),
1361 );
1362
1363 $settings_tabs_field->generate_field($args);
1364
1365
1366
1367
1368 ?>
1369
1370
1371 </div>
1372 <?php
1373
1374
1375 }
1376 }
1377
1378 add_action('related_post_settings_content_stats', 'related_post_settings_content_stats');
1379
1380 if (!function_exists('related_post_settings_content_stats')) {
1381 function related_post_settings_content_stats($tab)
1382 {
1383
1384 $settings_tabs_field = new settings_tabs_field();
1385
1386 $related_post_settings = get_option('related_post_settings');
1387
1388 $enable_stats = isset($related_post_settings['enable_stats']) ? $related_post_settings['enable_stats'] : 'disable';
1389 $custom_css = isset($related_post_settings['custom_css']) ? $related_post_settings['custom_css'] : '';
1390
1391 //echo '<pre>'.var_export($display_auto, true).'</pre>';
1392
1393 ?>
1394 <div class="section">
1395 <div class="section-title"><?php esc_html_e('Post query settings', 'related-post'); ?></div>
1396 <p class="description section-description"><?php esc_html_e('Choose post query settings.', 'related-post'); ?></p>
1397
1398 <?php
1399
1400
1401
1402 $args = array(
1403 'id' => 'enable_stats',
1404 'parent' => 'related_post_settings',
1405 'title' => __('Enable stats', 'related-post'),
1406 'details' => __('Enable trace click on related post.', 'related-post'),
1407 'type' => 'select',
1408 'value' => $enable_stats,
1409 'default' => 'disable',
1410 'args' => array('enable' => __('Enable', 'related-post'), 'disable' => __('Disable', 'related-post')),
1411 );
1412
1413 $settings_tabs_field->generate_field($args);
1414
1415
1416 ob_start();
1417 ?>
1418 <ul>
1419 <?php
1420
1421 global $wpdb;
1422 $table = $wpdb->prefix . "related_post_stats";
1423 $to_id = 'to_id';
1424
1425 //$entries = $wpdb->get_results( "SELECT * FROM $table ORDER BY id DESC LIMIT 0, 10" );
1426 $entries = $wpdb->get_results("SELECT * FROM $table GROUP BY $to_id ORDER BY COUNT($to_id) DESC LIMIT 10", ARRAY_A);
1427 $count_to_id = $wpdb->get_results("SELECT to_id, COUNT(*) AS to_id FROM $table GROUP BY to_id ORDER BY COUNT(to_id) DESC LIMIT 10", ARRAY_A);
1428 //echo '<pre>'.var_export($entries, true).'</pre>';
1429
1430 $i = 0;
1431 if (!empty($entries)) :
1432 foreach ($entries as $entry) {
1433 $to_id = $entry['to_id'];
1434 $title = get_the_title($to_id);
1435 ?>
1436 <li>
1437 <span><?php echo esc_html($count_to_id[$i]['to_id']); ?></span> <a href="#"><?php echo esc_html($title); ?></a>
1438 </li>
1439 <?php
1440 $i++;
1441 }
1442
1443 else :
1444 ?>
1445 <li>
1446 <?php esc_html_e("No stats yet.", 'related-post') ?>
1447 </li>
1448 <?php
1449
1450 endif;
1451 ?>
1452 </ul>
1453 <?php
1454
1455 $top_10_html = ob_get_clean();
1456
1457 $args = array(
1458 'id' => 'top_10',
1459 'parent' => 'related_post_settings',
1460 'title' => __('Top 10 visited post today', 'related-post'),
1461 'details' => '',
1462 'type' => 'custom_html',
1463 'html' => $top_10_html,
1464
1465 );
1466
1467 $settings_tabs_field->generate_field($args);
1468
1469
1470 ?>
1471
1472
1473 </div>
1474 <?php
1475
1476
1477 }
1478 }
1479
1480
1481
1482
1483
1484 add_action('related_post_settings_tabs_right_panel_general', 'related_post_settings_tabs_right_panel_general');
1485
1486 add_action('related_post_settings_tabs_right_panel_query', 'related_post_settings_tabs_right_panel_general');
1487 add_action('related_post_settings_tabs_right_panel_style', 'related_post_settings_tabs_right_panel_general');
1488 add_action('related_post_settings_tabs_right_panel_elements', 'related_post_settings_tabs_right_panel_general');
1489 add_action('related_post_settings_tabs_right_panel_slider', 'related_post_settings_tabs_right_panel_general');
1490 add_action('related_post_settings_tabs_right_panel_stats', 'related_post_settings_tabs_right_panel_general');
1491 add_action('related_post_settings_tabs_right_panel_buy_pro', 'related_post_settings_tabs_right_panel_general');
1492
1493
1494
1495
1496 if (!function_exists('related_post_settings_tabs_right_panel_general')) {
1497 function related_post_settings_tabs_right_panel_general($tab)
1498 {
1499
1500 ?>
1501 <h3>Help & Support</h3>
1502 <p><?php esc_html_e('Ask question for free on our forum and get quick reply from our expert team members.', 'related-post'); ?></p>
1503 <a class="button" href="https://www.pickplugins.com/create-support-ticket/"><?php esc_html_e('Create support ticket', 'related-post'); ?></a>
1504
1505 <p><?php esc_html_e('Read our documentation before asking your question.', 'related-post'); ?></p>
1506 <a class="button" href="https://www.pickplugins.com/documentation/related-post/"><?php esc_html_e('Documentation', 'related-post'); ?></a>
1507
1508 <p><?php esc_html_e('Watch video tutorials.', 'related-post'); ?></p>
1509 <a class="button" href="https://www.youtube.com/playlist?list=PL0QP7T2SN94aXEA_fguVn2ZpdizEeNmsx"><i class="fab fa-youtube"></i> <?php esc_html_e('All tutorials', 'related-post'); ?></a>
1510
1511 <ul>
1512 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=9SZKa0QYgsc">How to install & setup</a></li>
1513 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=tXBLwC3PQBI">Display on archive pages</a></li>
1514 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=_kWh4mP-eso">Customize elements</a></li>
1515 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=5G7o_zFKUhE">Manually selected post</a></li>
1516 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=KUtBCyFoARk">Related post slider layout</a></li>
1517 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=qudCJcqjlCk">Customize column count</a></li>
1518 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=uo2v9U9kUCc">Related posts as list layout</a></li>
1519 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=pztzF9R2yRQ">Custom html after elements</a> [Premium]</li>
1520 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=siMFvhy95Wo">Display on popups</a> [Premium]</li>
1521 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=qFZPMoqEHxs">Customize link target</a> [Premium]</li>
1522 </ul>
1523
1524 <h3>Submit Reviews</h3>
1525 <p class="">We wish your 2 minutes to write your feedback about the related post plugin. give us <span style="color: #ffae19"><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i></span></p>
1526
1527 <a target="_blank" href="https://wordpress.org/support/plugin/related-post/reviews/#new-post" class="button"><i class="fab fa-wordpress"></i> Write a review</a>
1528
1529
1530 <?php
1531
1532 }
1533 }
1534
1535
1536 add_action('related_post_settings_content_scripts', 'related_post_settings_content_scripts');
1537
1538 if (!function_exists('related_post_settings_content_scripts')) {
1539 function related_post_settings_content_scripts($tab)
1540 {
1541 $settings_tabs_field = new settings_tabs_field();
1542
1543 $related_post_settings = get_option('related_post_settings');
1544
1545 $custom_css = isset($related_post_settings['custom_css']) ? $related_post_settings['custom_css'] : '';
1546 $custom_js = isset($related_post_settings['custom_js']) ? $related_post_settings['custom_js'] : '';
1547
1548
1549 ?>
1550 <div class="section">
1551 <div class="section-title"><?php esc_html_e('Custom scripts and CSS', 'related-post'); ?></div>
1552 <p class="description section-description"><?php esc_html_e('Add your custom CSS and scripts here.', 'related-post'); ?></p>
1553
1554
1555
1556 <?php
1557
1558 $args = array(
1559 'id' => 'custom_css',
1560 'css_id' => 'custom_css_1',
1561
1562 'parent' => 'related_post_settings',
1563 'title' => __('Custom CSS', 'related-post'),
1564 'details' => __('Add your custom CSS, do not use <code> &ltstyle>&lt/style> tag.</code>', 'related-post'),
1565 'type' => 'scripts_css',
1566 'value' => $custom_css,
1567
1568 );
1569
1570 $settings_tabs_field->generate_field($args);
1571
1572
1573
1574 $args = array(
1575 'id' => 'custom_js',
1576 'parent' => 'related_post_settings',
1577 'title' => __('Custom JS', 'related-post'),
1578 'details' => __('Add your custom javascript, do not use <code> &ltscript>&lt/script> tag.</code>', 'related-post'),
1579 'type' => 'scripts_js',
1580 'value' => $custom_js,
1581
1582 );
1583
1584 $settings_tabs_field->generate_field($args);
1585
1586
1587
1588
1589
1590 ?>
1591
1592 </div>
1593 <?php
1594 }
1595 }
1596
1597
1598 add_action('related_post_settings_content_help_support', 'related_post_settings_content_help_support');
1599
1600 if (!function_exists('related_post_settings_content_help_support')) {
1601 function related_post_settings_content_help_support($tab)
1602 {
1603
1604 $settings_tabs_field = new settings_tabs_field();
1605
1606 ?>
1607 <div class="section">
1608 <div class="section-title"><?php esc_html_e('Get support', 'related-post'); ?></div>
1609 <p class="description section-description"><?php esc_html_e('Use following to get help and support from our expert team.', 'related-post'); ?></p>
1610
1611 <?php
1612
1613
1614 ob_start();
1615 ?>
1616
1617 <p><?php esc_html_e('Shortcode for php file', 'related-post'); ?></p>
1618 <textarea onclick="this.select()">&#60;?php echo do_shortcode( '&#91;related_post post_ids="1752,1743"&#93;' ); ?&#62;</textarea>
1619 <p class="description"><?php esc_html_e('Shortcode inside loop by dynamic post id you can use anywhere inside loop on .php files.', 'related-post'); ?></p>
1620
1621 <p><?php esc_html_e('Short-code for content', 'related-post'); ?></p>
1622 <textarea onclick="this.select()">[related_post post_ids="1752,1743"]</textarea>
1623
1624 <p class="description"><?php esc_html_e('Short-code inside content for fixed post id you can use anywhere inside content.', 'related-post'); ?></p>
1625 <?php
1626
1627 $html = ob_get_clean();
1628
1629 $args = array(
1630 'id' => 'shortcodes',
1631 'parent' => 'related_post_settings',
1632 'title' => __('Shortcodes', 'related-post'),
1633 'details' => '',
1634 'type' => 'custom_html',
1635 'html' => $html,
1636
1637 );
1638
1639 $settings_tabs_field->generate_field($args);
1640
1641
1642
1643 ob_start();
1644 ?>
1645
1646 <p><?php esc_html_e('Ask question for free on our forum and get quick reply from our expert team members.', 'related-post'); ?></p>
1647 <a class="button" href="https://www.pickplugins.com/create-support-ticket/"><?php esc_html_e('Create support ticket', 'related-post'); ?></a>
1648
1649 <p><?php esc_html_e('Read our documentation before asking your question.', 'related-post'); ?></p>
1650 <a class="button" href="https://www.pickplugins.com/documentation/related-post/"><?php esc_html_e('Documentation', 'related-post'); ?></a>
1651
1652 <p><?php esc_html_e('Watch video tutorials.', 'related-post'); ?></p>
1653 <a class="button" href="https://www.youtube.com/playlist?list=PL0QP7T2SN94aXEA_fguVn2ZpdizEeNmsx"><i class="fab fa-youtube"></i> <?php esc_html_e('All tutorials', 'related-post'); ?></a>
1654
1655 <ul>
1656 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=9SZKa0QYgsc">How to install & setup</a></li>
1657 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=tXBLwC3PQBI">Display on archive pages</a></li>
1658 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=_kWh4mP-eso">Customize elements</a></li>
1659 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=5G7o_zFKUhE">Manually selected post</a></li>
1660 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=KUtBCyFoARk">Related post slider layout</a></li>
1661 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=qudCJcqjlCk">Customize column count</a></li>
1662 <li><i class="far fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=uo2v9U9kUCc">Related posts as list layout</a></li>
1663 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=pztzF9R2yRQ">Display custom html after elements</a> [ Premium ]</li>
1664 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=siMFvhy95Wo">Display on popups</a> [ Premium ]</li>
1665 <li><i class="fas fa-dot-circle"></i> <a href="https://www.youtube.com/watch?v=qFZPMoqEHxs">Customize link target</a> [ Premium ]</li>
1666 </ul>
1667
1668
1669
1670 <?php
1671
1672 $html = ob_get_clean();
1673
1674 $args = array(
1675 'id' => 'get_support',
1676 'parent' => 'related_post_settings',
1677 'title' => __('Ask question', 'related-post'),
1678 'details' => '',
1679 'type' => 'custom_html',
1680 'html' => $html,
1681
1682 );
1683
1684 $settings_tabs_field->generate_field($args);
1685
1686
1687 ob_start();
1688 ?>
1689
1690 <p class="">We wish your 2 minutes to write your feedback about the related post plugin. give us <span style="color: #ffae19"><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i></span></p>
1691
1692 <a target="_blank" href="https://wordpress.org/support/plugin/related-post/reviews/#new-post" class="button"><i class="fab fa-wordpress"></i> Write a review</a>
1693
1694
1695 <?php
1696
1697 $html = ob_get_clean();
1698
1699 $args = array(
1700 'id' => 'reviews',
1701 'parent' => 'related_post_settings',
1702 'title' => __('Submit reviews', 'related-post'),
1703 'details' => '',
1704 'type' => 'custom_html',
1705 'html' => $html,
1706
1707 );
1708
1709 $settings_tabs_field->generate_field($args);
1710
1711 ?>
1712
1713
1714 </div>
1715 <?php
1716
1717
1718 }
1719 }
1720
1721
1722
1723 add_action('related_post_settings_content_buy_pro', 'related_post_settings_content_buy_pro');
1724
1725 if (!function_exists('related_post_settings_content_buy_pro')) {
1726 function related_post_settings_content_buy_pro($tab)
1727 {
1728
1729 $settings_tabs_field = new settings_tabs_field();
1730
1731
1732 ?>
1733 <div class="section">
1734 <div class="section-title"><?php esc_html_e('Get Premium', 'related-post'); ?></div>
1735 <p class="description section-description"><?php esc_html_e('Thansk for using our plugin, if you looking for some advance feature please buy premium version.', 'related-post'); ?></p>
1736
1737 <?php
1738
1739
1740 ob_start();
1741 ?>
1742
1743 <p><?php esc_html_e('If you love our plugin and want more feature please consider to buy pro version.', 'related-post'); ?></p>
1744 <a class="button" href="https://www.pickplugins.com/item/related-post-for-wordpress/"><?php esc_html_e('Buy premium', 'related-post'); ?></a>
1745
1746 <h2>See the differences</h2>
1747
1748 <table class="pro-features">
1749 <thead>
1750 <tr>
1751 <th class="col-features">Features</th>
1752 <th class="col-free">Free</th>
1753 <th class="col-pro">Premium</th>
1754 </tr>
1755 </thead>
1756
1757 <tr>
1758 <td class="col-features">Popup related post</td>
1759 <td><i class="fas fa-times"></i></td>
1760 <td><i class="fas fa-check"></i></td>
1761 </tr>
1762
1763 <tr>
1764 <td class="col-features">Custom HTML after post title</td>
1765 <td><i class="fas fa-times"></i></td>
1766 <td><i class="fas fa-check"></i></td>
1767 </tr>
1768
1769 <tr>
1770 <td class="col-features">Custom HTML after post excerpt</td>
1771 <td><i class="fas fa-times"></i></td>
1772 <td><i class="fas fa-check"></i></td>
1773 </tr>
1774
1775 <tr>
1776 <td class="col-features">Custom HTML after post thumbnail</td>
1777 <td><i class="fas fa-times"></i></td>
1778 <td><i class="fas fa-check"></i></td>
1779 </tr>
1780
1781
1782 <tr>
1783 <td class="col-features">Link target for post title</td>
1784 <td><i class="fas fa-times"></i></td>
1785 <td><i class="fas fa-check"></i></td>
1786 </tr>
1787
1788 <tr>
1789 <td class="col-features">Link target for post excerpt</td>
1790 <td><i class="fas fa-times"></i></td>
1791 <td><i class="fas fa-check"></i></td>
1792 </tr>
1793
1794 <tr>
1795 <td class="col-features">Link target for post thumbnail</td>
1796 <td><i class="fas fa-times"></i></td>
1797 <td><i class="fas fa-check"></i></td>
1798 </tr>
1799
1800 <tr>
1801 <td class="col-features">4 Popup visible action</td>
1802 <td><i class="fas fa-times"></i></td>
1803 <td><i class="fas fa-check"></i></td>
1804 </tr>
1805
1806 <tr>
1807 <td class="col-features">8 Popup positions</td>
1808 <td><i class="fas fa-times"></i></td>
1809 <td><i class="fas fa-check"></i></td>
1810 </tr>
1811
1812 <tr>
1813 <td class="col-features">Popup custom width</td>
1814 <td><i class="fas fa-times"></i></td>
1815 <td><i class="fas fa-check"></i></td>
1816 </tr>
1817
1818
1819 <tr>
1820 <td class="col-features">Popup custom delay</td>
1821 <td><i class="fas fa-times"></i></td>
1822 <td><i class="fas fa-check"></i></td>
1823 </tr>
1824
1825 <tr>
1826 <td class="col-features">Display on custom post type</td>
1827 <td><i class="fas fa-check"></i></td>
1828 <td><i class="fas fa-check"></i></td>
1829 </tr>
1830
1831 <tr>
1832 <td class="col-features">Display on categories</td>
1833 <td><i class="fas fa-check"></i></td>
1834 <td><i class="fas fa-check"></i></td>
1835 </tr>
1836
1837 <tr>
1838 <td class="col-features">Display on tags</td>
1839 <td><i class="fas fa-check"></i></td>
1840 <td><i class="fas fa-check"></i></td>
1841 </tr>
1842 <tr>
1843 <td class="col-features">Display on author page</td>
1844 <td><i class="fas fa-check"></i></td>
1845 <td><i class="fas fa-check"></i></td>
1846 </tr>
1847
1848 <tr>
1849 <td class="col-features">Display on month page</td>
1850 <td><i class="fas fa-check"></i></td>
1851 <td><i class="fas fa-check"></i></td>
1852 </tr>
1853 <tr>
1854 <td class="col-features">Display on date page</td>
1855 <td><i class="fas fa-check"></i></td>
1856 <td><i class="fas fa-check"></i></td>
1857 </tr>
1858 <tr>
1859 <td class="col-features">Display on year page</td>
1860 <td><i class="fas fa-check"></i></td>
1861 <td><i class="fas fa-check"></i></td>
1862 </tr>
1863
1864 <tr>
1865 <td class="col-features">Display on Front page</td>
1866 <td><i class="fas fa-check"></i></td>
1867 <td><i class="fas fa-check"></i></td>
1868 </tr>
1869
1870 <tr>
1871 <td class="col-features">Display on Blog page</td>
1872 <td><i class="fas fa-check"></i></td>
1873 <td><i class="fas fa-check"></i></td>
1874 </tr>
1875
1876 <tr>
1877 <td class="col-features">Display on Home page</td>
1878 <td><i class="fas fa-check"></i></td>
1879 <td><i class="fas fa-check"></i></td>
1880 </tr>
1881
1882 <tr>
1883 <td class="col-features">Display on custom taxonomies</td>
1884 <td><i class="fas fa-check"></i></td>
1885 <td><i class="fas fa-check"></i></td>
1886 </tr>
1887
1888 <tr>
1889 <td class="col-features">Display before/after content</td>
1890 <td><i class="fas fa-check"></i></td>
1891 <td><i class="fas fa-check"></i></td>
1892 </tr>
1893
1894 <tr>
1895 <td class="col-features">Display before/after excerpt</td>
1896 <td><i class="fas fa-check"></i></td>
1897 <td><i class="fas fa-check"></i></td>
1898 </tr>
1899
1900 <tr>
1901 <td class="col-features">N'th paragraph on content</td>
1902 <td><i class="fas fa-check"></i></td>
1903 <td><i class="fas fa-check"></i></td>
1904 </tr>
1905
1906 <tr>
1907 <td class="col-features">Custom headline text</td>
1908 <td><i class="fas fa-check"></i></td>
1909 <td><i class="fas fa-check"></i></td>
1910 </tr>
1911 <tr>
1912 <td class="col-features">Click tracking</td>
1913 <td><i class="fas fa-check"></i></td>
1914 <td><i class="fas fa-check"></i></td>
1915 </tr>
1916
1917 <tr>
1918 <td class="col-features">Related post on slider</td>
1919 <td><i class="fas fa-check"></i></td>
1920 <td><i class="fas fa-check"></i></td>
1921 </tr>
1922
1923 <tr>
1924 <td class="col-features">Slider custom column number</td>
1925 <td><i class="fas fa-check"></i></td>
1926 <td><i class="fas fa-check"></i></td>
1927 </tr>
1928 <tr>
1929 <th class="col-features">Features</th>
1930 <th class="col-free">Free</th>
1931 <th class="col-pro">Premium</th>
1932 </tr>
1933 <tr>
1934 <td class="col-features">Buy now</td>
1935 <td> </td>
1936 <td><a class="button" href="https://www.pickplugins.com/item/related-post-for-wordpress/"><?php esc_html_e('Buy premium', 'related-post'); ?></a></td>
1937 </tr>
1938
1939 </table>
1940
1941
1942
1943 <?php
1944
1945 $html = ob_get_clean();
1946
1947 $args = array(
1948 'id' => 'get_pro',
1949 'parent' => 'related_post_settings',
1950 'title' => __('Get pro version', 'related-post'),
1951 'details' => '',
1952 'type' => 'custom_html',
1953 'html' => $html,
1954
1955 );
1956
1957 $settings_tabs_field->generate_field($args);
1958
1959
1960 ?>
1961
1962
1963 </div>
1964
1965 <style>
1966 .pro-features {
1967 margin: 30px 0;
1968 border-collapse: collapse;
1969 border: 1px solid #ddd;
1970 }
1971
1972 .pro-features th {
1973 width: 120px;
1974 background: #ddd;
1975 padding: 10px;
1976 }
1977
1978 .pro-features tr {}
1979
1980 .pro-features td {
1981 border-bottom: 1px solid #ddd;
1982 padding: 10px 10px;
1983 text-align: center;
1984 }
1985
1986 .pro-features .col-features {
1987 width: 230px;
1988 text-align: left;
1989 }
1990
1991 .pro-features .col-free {}
1992
1993 .pro-features .col-pro {}
1994
1995 .pro-features i.fas.fa-check {
1996 color: #139e3e;
1997 font-size: 16px;
1998 }
1999
2000 .pro-features i.fas.fa-times {
2001 color: #f00;
2002 font-size: 17px;
2003 }
2004 </style>
2005 <?php
2006
2007
2008 }
2009 }
2010