Post Grid - Version 2.0.13

Version Description

  • 03/10/2016 fix - Fix some security issues.
Download this release

Release Info

Developer paratheme
Plugin Icon 128x128 Post Grid
Version 2.0.13
Comparing to
See all releases

Code changes from version 2.0.12 to 2.0.13

assets/admin/js/scripts-new.js CHANGED
@@ -237,6 +237,25 @@ jQuery(document).ready(function($)
237
238
239
240
241
$(document).on('click', '.post-grid-settings .remove_export_content_layout', function()
242
{
@@ -267,9 +286,6 @@ jQuery(document).ready(function($)
267
268
269
270
-
271
-
272
-
273
$(document).on('click', '.post-grid-settings .remove-layout', function()
274
{
275
var layout_id = $(this).attr('layout-id');
@@ -302,26 +318,6 @@ jQuery(document).ready(function($)
302
303
304
305
- $(document).on('click', '#post-grid-upgrade', function()
306
- {
307
-
308
- jQuery.ajax(
309
- {
310
- type: 'POST',
311
- context: this,
312
- url: post_grid_ajax.post_grid_ajaxurl,
313
- data: {"action": "post_grid_upgrade_action",},
314
- success: function(data)
315
- {
316
- $(this).html('Upgrade Done!');
317
- $(this).parent().fadeOut();
318
-
319
-
320
- }
321
- });
322
-
323
-
324
- })
325
326
327
@@ -376,27 +372,6 @@ jQuery(document).ready(function($)
376
377
378
379
- $(document).on('click', '.post-grid-settings .export-content-layouts', function()
380
- {
381
-
382
- jQuery.ajax(
383
- {
384
- type: 'POST',
385
- context: this,
386
- url: post_grid_ajax.post_grid_ajaxurl,
387
- data: {"action": "post_grid_export_content_layouts",},
388
- success: function(data)
389
- {
390
- $(this).html('Export Done!');
391
-
392
- window.open(data,'_blank');
393
-
394
-
395
- }
396
- });
397
-
398
- })
399
-
400
401
402
237
238
239
240
+ $(document).on('click', '.post-grid-settings .export-content-layouts', function(){
241
+
242
+ jQuery.ajax(
243
+ {
244
+ type: 'POST',
245
+ context: this,
246
+ url: post_grid_ajax.post_grid_ajaxurl,
247
+ data: {"action": "post_grid_export_content_layouts",},
248
+ success: function(data)
249
+ {
250
+ $(this).html('Export Done!');
251
+
252
+ window.open(data,'_blank');
253
+
254
+
255
+ }
256
+ });
257
+
258
+ })
259
260
$(document).on('click', '.post-grid-settings .remove_export_content_layout', function()
261
{
286
287
288
289
$(document).on('click', '.post-grid-settings .remove-layout', function()
290
{
291
var layout_id = $(this).attr('layout-id');
318
319
320
321
322
323
372
373
374
375
376
377
grid-items/nav-bottom.php DELETED
@@ -1,165 +0,0 @@
1
- <?php
2
- /*
3
- * @Author pickplugins
4
- * Copyright: 2015 pickplugins.com
5
- */
6
-
7
- if ( ! defined('ABSPATH')) exit; // if direct access
8
-
9
- $html .= '<div class="pagination '.$pagination_theme.'">';
10
-
11
-
12
-
13
- if($max_num_pages==0){
14
-
15
- $max_num_pages = $wp_query->max_num_pages;
16
-
17
- }
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
- if($pagination_type=='pagination'){
26
-
27
- if($nav_top_filter=='yes'){
28
-
29
- $html .= '<div class="pager-list pager-list-'.$post_id.'"></div >';
30
- }
31
- else{
32
- $html .= '<div class="paginate">';
33
-
34
-
35
-
36
- $big = 999999999; // need an unlikely integer
37
-
38
- $html .= paginate_links( array(
39
- 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
40
- 'format' => '?paged=%#%',
41
- 'current' => max( 1, $paged ),
42
- 'total' => $max_num_pages,
43
- 'prev_text' => $pagination_prev_text,
44
- 'next_text' => $pagination_next_text,
45
- ) );
46
-
47
-
48
- /*
49
-
50
- $pagination_base = add_query_arg( $paging, '%#%' );
51
-
52
- $html .= paginate_links( array(
53
- 'type' => '',
54
- 'base' => $pagination_base,
55
- 'format' => '?'. $paging .'=%#%',
56
- 'current' => max( 1, $wp_query->get('paged') ),
57
- 'total' => $max_num_pages,
58
- 'prev_text' => $pagination_prev_text,
59
- 'next_text' => $pagination_next_text,
60
-
61
-
62
- ));
63
-
64
-
65
- */
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
- $html .= '</div >';
75
-
76
- }
77
-
78
-
79
- }
80
-
81
- elseif($pagination_type=='jquery-pagination'){
82
-
83
- $html .= '<div class="pager-list pager-list-'.$post_id.'"></div >';
84
-
85
-
86
-
87
- $html .= '<script>
88
- jQuery(document).ready(function($) {
89
-
90
- $(function(){
91
-
92
- $("#post-grid-'.$post_id.'").mixItUp({
93
- pagination: {
94
- limit: '.$filterable_post_per_page.',
95
- prevButtonHTML: "'.$pagination_prev_text.'",
96
- nextButtonHTML: "'.$pagination_next_text.'",
97
-
98
-
99
- },
100
- selectors: {
101
- filter: ".filter",
102
- pagersWrapper: ".pager-list-'.$post_id.'",
103
-
104
-
105
- },';
106
-
107
- if(!empty($active_filter) && $active_filter!= 'all')
108
- {
109
-
110
-
111
- $html .= '
112
- load: {
113
- filter: ".'.$active_filter.'"
114
- }, ';
115
-
116
- }
117
-
118
- $html .= 'controls: {
119
- enable: true
120
- }
121
-
122
- });
123
-
124
- });
125
-
126
-
127
-
128
-
129
- });
130
- </script>';
131
-
132
-
133
-
134
- $html .= '<style type="text/css">
135
-
136
- #post-grid-'.$post_id.' .grid-items .mix{
137
- display: none;
138
- }
139
-
140
-
141
- </style>
142
- ';
143
-
144
-
145
-
146
- }
147
-
148
- elseif($pagination_type=='load_more'){
149
-
150
- if(!empty($paged))
151
- {
152
- $paged = $paged+1;
153
- }
154
-
155
- $html .= '<div grid_id="'.$post_id.'" class="load-more" paged="'.$paged.'" per_page="'.$posts_per_page.'" >'.__('Load more',post_grid_textdomain).'</div >';
156
-
157
-
158
- }
159
-
160
-
161
-
162
-
163
-
164
-
165
- $html .= '</div >';
grid-items/nav-top-new.php CHANGED
@@ -12,6 +12,8 @@ if ( ! defined('ABSPATH')) exit; // if direct access
12
13
if($nav_top_search=='yes'){
14
15
if(isset($_GET['keyword'])){
16
17
$keyword = sanitize_text_field($_GET['keyword']);
12
13
if($nav_top_search=='yes'){
14
15
+
16
+
17
if(isset($_GET['keyword'])){
18
19
$keyword = sanitize_text_field($_GET['keyword']);
grid-items/nav-top.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
- /*
3
- * @Author pickplugins
4
- * Copyright: 2015 pickplugins.com
5
- */
6
-
7
- if ( ! defined('ABSPATH')) exit; // if direct access
8
-
9
-
10
- if($nav_top_filter=='yes'){
11
-
12
- $html.= '<div class="nav-filter">';
13
-
14
-
15
- if(!empty($categories)){
16
-
17
- foreach($categories as $category){
18
-
19
- $tax_cat = explode(',',$category);
20
-
21
- $categories_info[] = array($tax_cat[1],$tax_cat[0]);
22
-
23
- }
24
-
25
- $html.= '<div class="filter filter-'.$post_id.'" data-filter="all">'.__('All', post_grid_textdomain).'</div>';
26
-
27
- foreach($categories_info as $term_info)
28
- {
29
-
30
- $term = get_term( $term_info[0], $term_info[1] );
31
- $term_slug = $term->slug;
32
- $term_name = $term->name;
33
- $html .= '<div class="filter filter-'.$post_id.'" terms-id="'.$term_info[0].'" data-filter=".'.$term_slug.'" >'.$term_name.'</div>';
34
- }
35
-
36
- }
37
-
38
- $html.= '</div>';
39
-
40
-
41
-
42
- /*
43
-
44
- $html .= '<script>
45
- jQuery(document).ready(function($) {
46
-
47
- // init Isotope
48
- var $grid = $(".grid-items").isotope({
49
- layoutMode: "masonry",
50
- masonry: {
51
- isFitWidth: true
52
- },
53
- filter: ".'.$active_filter.'"
54
-
55
- });
56
-
57
-
58
- // filter items on button click
59
- $(".nav-filter").on( "click", ".filter", function() {
60
-
61
- var filterValue = $(this).attr("data-filter");
62
- $grid.isotope({ filter: filterValue });
63
- });
64
-
65
- });
66
- </script>';
67
-
68
- */
69
-
70
- //var_dump($active_filter);
71
-
72
- $html .= '<script>
73
- jQuery(document).ready(function($) {
74
-
75
- $(function(){
76
-
77
- $("#post-grid-'.$post_id.'").mixItUp({
78
- pagination: {
79
- limit: '.$filterable_post_per_page.',
80
- prevButtonHTML: "'.$pagination_prev_text.'",
81
- nextButtonHTML: "'.$pagination_next_text.'",
82
-
83
-
84
-
85
- },
86
- selectors: {
87
- pagersWrapper: ".pager-list-'.$post_id.'",
88
- filter: ".filter-'.$post_id.'",
89
-
90
- },';
91
-
92
- if(!empty($active_filter) && $active_filter!= 'all')
93
- {
94
-
95
-
96
- $html .= '
97
- load: {
98
- filter: ".'.$active_filter.'"
99
- }, ';
100
-
101
- }
102
-
103
- $html .= 'controls: {
104
- enable: true
105
- }
106
-
107
- });
108
-
109
- });
110
-
111
-
112
-
113
-
114
- });
115
- </script>';
116
-
117
-
118
-
119
- $html .= '<style type="text/css">
120
-
121
- #post-grid-'.$post_id.' .grid-items .mix{
122
- display: none;
123
- }
124
-
125
-
126
- </style>
127
- ';
128
-
129
-
130
-
131
- }
132
- if($nav_top_search=='yes'){
133
-
134
- if(isset($_GET['keyword'])){
135
-
136
- $keyword = $_GET['keyword'];
137
-
138
- }
139
-
140
- $html.= '<div class="nav-search">';
141
- $html.= '<input grid_id="'.$post_id.'" placeholder="'.__('Start typing...', post_grid_textdomain).'" class="search" type="text" value="'.$keyword.'" name="" />';
142
-
143
- $html.= '</div>';
144
- }
145
-
146
-
grid-items/query.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined('ABSPATH')) exit; // if direct access
9
10
if(isset($_GET['keyword'])){
11
12
- $keyword = $_GET['keyword'];
13
14
}
15
9
10
if(isset($_GET['keyword'])){
11
12
+ $keyword = sanitize_text_field($_GET['keyword']);
13
14
}
15
grid-items/scripts.php CHANGED
@@ -24,12 +24,6 @@ if ( ! defined('ABSPATH')) exit; // if direct access
24
25
';
26
27
-
28
-
29
-
30
-
31
-
32
-
33
$html .='});
34
35
});';
24
25
';
26
27
$html .='});
28
29
});';
includes/class-shortcodes.php CHANGED
@@ -13,7 +13,7 @@ class class_post_grid_shortcodes{
13
public function __construct(){
14
15
add_shortcode( 'post_grid', array( $this, 'post_grid_new_display' ) );
16
- //add_shortcode( 'post_grid_new', array( $this, 'post_grid_new_display' ) );
17
18
}
19
@@ -176,176 +176,9 @@ class class_post_grid_shortcodes{
176
177
}
178
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
- public function post_grid_display($atts, $content = null ) {
189
-
190
- /*
191
-
192
- static $w4dev_custom_loop;
193
- if( !isset($w4dev_custom_loop) ){
194
- $w4dev_custom_loop = 1;
195
- }
196
-
197
- else{
198
- $w4dev_custom_loop ++;
199
- }
200
-
201
- */
202
-
203
-
204
-
205
- $atts = shortcode_atts(
206
- array(
207
- 'id' => "",
208
- ///'paging'=> 'pg'. $w4dev_custom_loop,
209
- ), $atts);
210
-
211
- $html = '';
212
- $post_id = $atts['id'];
213
-
214
- /*
215
-
216
- $paging = $atts['paging'];
217
- unset( $atts['paging'] );
218
-
219
- */
220
-
221
-
222
-
223
-
224
- //var_dump($w4dev_custom_loop);
225
-
226
-
227
228
229
230
- include post_grid_plugin_dir.'/grid-items/variables.php';
231
-
232
-
233
-
234
-
235
- /*
236
-
237
- if( isset($_GET[$paging]) ){
238
- $paged = (int)$_GET[$paging];
239
-
240
- }
241
-
242
- else{
243
- $paged = 1;
244
- }
245
-
246
-
247
- */
248
-
249
-
250
-
251
-
252
-
253
- include post_grid_plugin_dir.'/grid-items/query.php';
254
- include post_grid_plugin_dir.'/grid-items/custom-css.php';
255
- include post_grid_plugin_dir.'/grid-items/lazy.php';
256
-
257
- if($enable_multi_skin=='yes'){
258
- $skin_main = $skin;
259
- }
260
-
261
-
262
-
263
-
264
-
265
- //$html.='<div class="post-grid-debug"></div>'; // .debug
266
-
267
- $html.='<div id="post-grid-'.$post_id.'" class="post-grid">';
268
-
269
- if ( $wp_query->have_posts() ) :
270
-
271
- $html.='<div class="grid-nav-top">';
272
- include post_grid_plugin_dir.'/grid-items/nav-top.php';
273
- $html.='</div>'; // .grid-nav-top
274
-
275
- $html.='<div class="grid-items" id="">';
276
-
277
-
278
- $odd_even = 0;
279
-
280
- while ( $wp_query->have_posts() ) : $wp_query->the_post();
281
-
282
- $post_grid_post_settings = get_post_meta( get_the_ID(), 'post_grid_post_settings', true );
283
-
284
-
285
- //var_dump($post_grid_post_settings);
286
-
287
- if($enable_multi_skin=='yes'){
288
-
289
- if(!empty($post_grid_post_settings['post_skin'])){
290
-
291
- $skin = $post_grid_post_settings['post_skin'];
292
-
293
- }
294
- else{
295
-
296
- $skin = $skin_main;
297
- }
298
-
299
- }
300
-
301
- if($odd_even%2==0){
302
- $odd_even_calss = 'even';
303
- }
304
- else{
305
- $odd_even_calss = 'odd';
306
- }
307
- $odd_even++;
308
-
309
- $html.='<div class="item mix skin '.$odd_even_calss.' '.$skin.' '.post_grid_term_slug_list(get_the_ID()).'">';
310
-
311
- include post_grid_plugin_dir.'/grid-items/layer-media.php';
312
- include post_grid_plugin_dir.'/grid-items/layer-content.php';
313
- include post_grid_plugin_dir.'/grid-items/layer-hover.php';
314
-
315
- $html.='</div>'; // .item
316
-
317
- endwhile;
318
- wp_reset_query();
319
- $html.='</div>'; // .grid-items
320
-
321
- $html.='<div class="grid-nav-bottom">';
322
- include post_grid_plugin_dir.'/grid-items/nav-bottom.php';
323
- $html.='</div>'; // .grid-nav-bottom
324
-
325
- //wp_reset_query();
326
- else:
327
- $html.='<div class="no-post-found">';
328
- $html.=__('No Post found',post_grid_textdomain); // .item
329
- $html.='</div>'; // .item
330
-
331
- endif;
332
-
333
- include post_grid_plugin_dir.'/grid-items/scripts.php';
334
- $html.='</div>'; // .post-grid
335
-
336
- if($masonry_enable=='yes'){
337
- $html .= '<script>jQuery(window).load(function(){jQuery("#post-grid-'.$post_id.' .grid-items").masonry({isFitWidth: true}); });</script>';
338
- }
339
-
340
-
341
-
342
-
343
- return $html;
344
-
345
-
346
- }
347
-
348
-
349
350
351
13
public function __construct(){
14
15
add_shortcode( 'post_grid', array( $this, 'post_grid_new_display' ) );
16
+
17
18
}
19
176
177
}
178
179
180
181
182
183
184
includes/functions.php CHANGED
@@ -8,76 +8,12 @@
8
if ( ! defined('ABSPATH')) exit; // if direct access
9
10
11
- /*
12
-
13
- function post_grid_filter_media_source_extra($media_source){
14
-
15
- $media_source_extra = array(
16
- 'media_source_new' =>array('id'=>'media_source_new','title'=>'Media source new','checked'=>'yes'),
17
-
18
- );
19
- return array_merge($media_source, $media_source_extra);
20
-
21
- }
22
-
23
- add_filter('post_grid_filter_media_source','post_grid_filter_media_source_extra');
24
-
25
-
26
- */
27
-
28
- function w4dev_custom_loop_shortcode( $atts ){
29
- static $w4dev_custom_loop;
30
- if( !isset($w4dev_custom_loop) )
31
- $w4dev_custom_loop = 1;
32
- else
33
- $w4dev_custom_loop ++;
34
-
35
- $atts = shortcode_atts( array(
36
- 'paging' => 'pg'. $w4dev_custom_loop,
37
- 'post_type' => 'post',
38
- 'posts_per_page' => '5',
39
- 'post_status' => 'publish'
40
- ), $atts );
41
-
42
- $paging = $atts['paging'];
43
- unset( $atts['paging'] );
44
45
- if( isset($_GET[$paging]) )
46
- $atts['paged'] = $_GET[$paging];
47
- else
48
- $atts['paged'] = 1;
49
50
- $html = '';
51
- $custom_query = new WP_Query( $atts );
52
53
54
-
55
-
56
- if( $custom_query->have_posts() ):
57
- $html .= '<ul>';
58
- while( $custom_query->have_posts()) : $custom_query->the_post();
59
- $html .= sprintf(
60
- '<li><a href="%1$s">%2$s</a></li>',
61
- get_permalink(),
62
- get_the_title()
63
- );
64
- endwhile;
65
- $html .= '</ul>';
66
- endif;
67
68
- $pagination_base = add_query_arg( $paging, '%#%' );
69
70
- $html .= paginate_links( array(
71
- 'type' => '',
72
- 'base' => $pagination_base,
73
- 'format' => '?'. $paging .'=%#%',
74
- 'current' => max( 1, $custom_query->get('paged') ),
75
- 'total' => $custom_query->max_num_pages
76
- ));
77
-
78
- return $html;
79
- }
80
- //add_shortcode( 'w4dev_custom_loop', 'w4dev_custom_loop_shortcode' );
81
82
83
@@ -93,7 +29,7 @@ function post_grid_posts_shortcode_display( $column, $post_id ) {
93
if ($column == 'shortcode'){
94
?>
95
<input style="background:#bfefff" type="text" onClick="this.select();" value="[post_grid <?php echo 'id=&quot;'.$post_id.'&quot;';?>]" /><br />
96
- <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[post_grid id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea>
97
<?php
98
99
}
@@ -594,133 +530,44 @@ function post_grid_get_media($media_source, $featured_img_size, $thumb_linked){
594
595
function post_grid_remove_content_layout_ajax(){
596
597
- $layout_id = $_POST['layout_id'];
598
-
599
- $post_grid_layout_content = get_option('post_grid_layout_content');
600
-
601
- //var_dump($post_grid_layout_content[$layout_id]);
602
-
603
- unset($post_grid_layout_content[$layout_id]);
604
-
605
- update_option('post_grid_layout_content',$post_grid_layout_content);
606
-
607
-
608
- die();
609
-
610
- }
611
-
612
-
613
- add_action('wp_ajax_post_grid_remove_content_layout_ajax', 'post_grid_remove_content_layout_ajax');
614
- add_action('wp_ajax_nopriv_post_grid_remove_content_layout_ajax', 'post_grid_remove_content_layout_ajax');
615
-
616
-
617
-
618
-
619
- function post_grid_reset_content_layouts(){
620
-
621
-
622
- $class_post_grid_functions = new class_post_grid_functions();
623
- $layout_content_list = $class_post_grid_functions->layout_content_list();
624
- update_option('post_grid_layout_content', $layout_content_list);
625
-
626
- die();
627
- }
628
-
629
-
630
- add_action('wp_ajax_post_grid_reset_content_layouts', 'post_grid_reset_content_layouts');
631
- add_action('wp_ajax_nopriv_post_grid_reset_content_layouts', 'post_grid_reset_content_layouts');
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
- /*
640
-
641
- function post_grid_import_content_layouts(){
642
-
643
- $layouts_data = stripslashes($_POST['layouts_data']);
644
- $layouts_data = unserialize($layouts_data);
645
-
646
- //update_option('post_grid_layout_content', $layouts_data);
647
-
648
- if(!empty($layouts_data)){
649
650
$post_grid_layout_content = get_option('post_grid_layout_content');
651
- $post_grid_layout_content = array_merge($post_grid_layout_content,$layouts_data);
652
653
- update_option('post_grid_layout_content', $post_grid_layout_content);
654
655
}
656
-
657
658
die();
659
}
660
661
-
662
- add_action('wp_ajax_post_grid_import_content_layouts', 'post_grid_import_content_layouts');
663
- add_action('wp_ajax_nopriv_post_grid_import_content_layouts', 'post_grid_import_content_layouts');
664
-
665
- */
666
-
667
-
668
-
669
-
670
-
671
-
672
673
674
675
676
- function post_grid_export_content_layouts(){
677
-
678
679
- $post_grid_layout_content = get_option('post_grid_layout_content');
680
-
681
- $export_data = serialize($post_grid_layout_content);
682
-
683
-
684
- //$myfile = fopen(post_grid_plugin_dir."/export/export-layout-content-".date('Y-m-d-h').'-'.time().".txt", "w");
685
-
686
- $myfile = fopen(ABSPATH."wp-content/uploads/post-grid/export-layout-content-".date('Y-m-d-h').'-'.time().".txt", "w");
687
688
-
689
- fwrite($myfile, $export_data);
690
-
691
- $file_url = get_bloginfo('url')."/wp-content/uploads/post-grid/export-layout-content-".date('Y-m-d-h').'-'.time().".txt";
692
- //$file_url = post_grid_plugin_url."export/export-layout-content-".date('Y-m-d-h').'-'.time().".txt";
693
694
695
-
696
- echo $file_url;
697
-
698
- fclose($myfile);
699
-
700
701
die();
702
}
703
704
705
- add_action('wp_ajax_post_grid_export_content_layouts', 'post_grid_export_content_layouts');
706
- add_action('wp_ajax_nopriv_post_grid_export_content_layouts', 'post_grid_export_content_layouts');
707
-
708
-
709
-
710
-
711
- function post_grid_ajax_remove_export_content_layout(){
712
-
713
- $file_url = $_POST['file_url'];
714
-
715
- unlink($file_url);
716
-
717
-
718
- die();
719
- }
720
721
722
- add_action('wp_ajax_post_grid_ajax_remove_export_content_layout', 'post_grid_ajax_remove_export_content_layout');
723
- add_action('wp_ajax_nopriv_post_grid_ajax_remove_export_content_layout', 'post_grid_ajax_remove_export_content_layout');
724
725
726
@@ -728,6 +575,8 @@ add_action('wp_ajax_nopriv_post_grid_ajax_remove_export_content_layout', 'post_g
728
729
730
function post_grid_term_slug_list($post_id){
731
$term_slug_list = '';
732
733
$post_taxonomies = get_post_taxonomies($post_id);
@@ -813,6 +662,8 @@ function post_grid_posttypes($post_types){
813
814
$html .= '</select>';
815
return $html;
816
}
817
818
@@ -822,202 +673,205 @@ function post_grid_posttypes($post_types){
822
823
function post_grid_layout_content_ajax(){
824
825
- $layout_key = $_POST['layout'];
826
-
827
- $class_post_grid_functions = new class_post_grid_functions();
828
-
829
-
830
- $post_grid_layout_content = get_option( 'post_grid_layout_content' );
831
-
832
- if(empty($post_grid_layout_content)){
833
- $layout = $class_post_grid_functions->layout_content($layout_key);
834
- }
835
- else{
836
- $layout = $post_grid_layout_content[$layout_key];
837
-
838
- }
839
-
840
- //$layout = $class_post_grid_functions->layout_content($layout_key);
841
-
842
-
843
844
- ?>
845
- <div class="<?php echo $layout_key; ?>">
846
- <?php
847
-
848
- foreach($layout as $item_key=>$item_info){
849
- $item_key = $item_info['key'];
850
- ?>
851
852
-
853
- <div class="item <?php echo $item_key; ?>" style=" <?php echo $item_info['css']; ?> ">
854
-
855
- <?php
856
857
- if($item_key=='thumb'){
858
-
859
- ?>
860
- <img src="<?php echo post_grid_plugin_url; ?>assets/admin/images/thumb.png" />
861
- <?php
862
- }
863
-
864
- elseif($item_key=='title'){
865
-
866
- ?>
867
- Lorem Ipsum is simply
868
-
869
- <?php
870
- }
871
-
872
- elseif($item_key=='excerpt'){
873
-
874
- ?>
875
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text
876
- <?php
877
- }
878
-
879
- elseif($item_key=='excerpt_read_more'){
880
-
881
- ?>
882
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text <a href="#">Read more</a>
883
- <?php
884
- }
885
-
886
- elseif($item_key=='read_more'){
887
-
888
- ?>
889
- <a href="#">Read more</a>
890
- <?php
891
- }
892
-
893
- elseif($item_key=='post_date'){
894
-
895
- ?>
896
- 18/06/2015
897
- <?php
898
- }
899
-
900
- elseif($item_key=='author'){
901
-
902
- ?>
903
- PickPlugins
904
- <?php
905
- }
906
-
907
- elseif($item_key=='categories'){
908
-
909
- ?>
910
- <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
911
- <?php
912
- }
913
-
914
- elseif($item_key=='tags'){
915
-
916
- ?>
917
- <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
918
- <?php
919
- }
920
-
921
- elseif($item_key=='comments_count'){
922
-
923
- ?>
924
- 3 Comments
925
- <?php
926
- }
927
-
928
- // WooCommerce
929
- elseif($item_key=='wc_full_price'){
930
-
931
- ?>
932
- <del>$45</del> - <ins>$40</ins>
933
- <?php
934
- }
935
- elseif($item_key=='wc_sale_price'){
936
-
937
- ?>
938
- $45
939
- <?php
940
- }
941
-
942
- elseif($item_key=='wc_regular_price'){
943
-
944
- ?>
945
- $45
946
- <?php
947
- }
948
-
949
- elseif($item_key=='wc_add_to_cart'){
950
951
- ?>
952
- Add to Cart
953
<?php
954
- }
955
956
- elseif($item_key=='wc_rating_star'){
957
-
958
- ?>
959
- *****
960
- <?php
961
- }
962
963
- elseif($item_key=='wc_rating_text'){
964
-
965
- ?>
966
- 2 Reviews
967
- <?php
968
- }
969
- elseif($item_key=='wc_categories'){
970
971
?>
972
- <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
973
- <?php
974
- }
975
-
976
- elseif($item_key=='wc_tags'){
977
978
- ?>
979
- <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
980
- <?php
981
- }
982
983
- elseif($item_key=='edd_price'){
984
985
- ?>
986
- $45
987
<?php
988
- }
989
-
990
-
991
- else{
992
-
993
- echo $item_info['name'];
994
-
995
- }
996
-
997
- ?>
998
-
999
-
1000
-
1001
- </div>
1002
- <?php
1003
- }
1004
-
1005
- ?>
1006
- </div>
1007
- <?php
1008
-
1009
- die();
1010
-
1011
- }
1012
-
1013
- add_action('wp_ajax_post_grid_layout_content_ajax', 'post_grid_layout_content_ajax');
1014
- add_action('wp_ajax_nopriv_post_grid_layout_content_ajax', 'post_grid_layout_content_ajax');
1015
-
1016
-
1017
-
1018
-
1019
-
1020
1021
1022
1023
@@ -1029,430 +883,259 @@ add_action('wp_ajax_nopriv_post_grid_layout_content_ajax', 'post_grid_layout_con
1029
1030
1031
1032
1033
- function post_grid_layout_hover_ajax(){
1034
1035
- $layout_key = $_POST['layout'];
1036
1037
- $class_post_grid_functions = new class_post_grid_functions();
1038
- $layout = $class_post_grid_functions->layout_hover($layout_key);
1039
1040
1041
-
1042
- ?>
1043
- <div class="<?php echo $layout_key; ?>">
1044
- <?php
1045
-
1046
- foreach($layout as $item_key=>$item_info){
1047
1048
- ?>
1049
1050
-
1051
- <div class="item <?php echo $item_key; ?>" style=" <?php echo $item_info['css']; ?> ">
1052
-
1053
- <?php
1054
-
1055
- if($item_key=='thumb'){
1056
-
1057
- ?>
1058
- <img src="<?php echo post_grid_plugin_url; ?>assets/admin/images/thumb.png" />
1059
- <?php
1060
- }
1061
-
1062
- elseif($item_key=='title'){
1063
-
1064
- ?>
1065
- Lorem Ipsum is simply
1066
-
1067
- <?php
1068
- }
1069
-
1070
- elseif($item_key=='excerpt'){
1071
-
1072
- ?>
1073
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text
1074
- <?php
1075
- }
1076
-
1077
- elseif($item_key=='excerpt_read_more'){
1078
-
1079
- ?>
1080
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text <a href="#">Read more</a>
1081
- <?php
1082
- }
1083
-
1084
- elseif($item_key=='read_more'){
1085
-
1086
- ?>
1087
- <a href="#">Read more</a>
1088
- <?php
1089
- }
1090
-
1091
- elseif($item_key=='post_date'){
1092
-
1093
- ?>
1094
- 18/06/2015
1095
- <?php
1096
- }
1097
-
1098
- elseif($item_key=='author'){
1099
-
1100
- ?>
1101
- PickPlugins
1102
- <?php
1103
- }
1104
-
1105
- elseif($item_key=='categories'){
1106
-
1107
- ?>
1108
- <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
1109
- <?php
1110
- }
1111
-
1112
- elseif($item_key=='tags'){
1113
-
1114
- ?>
1115
- <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
1116
- <?php
1117
- }
1118
-
1119
- elseif($item_key=='comments_count'){
1120
-
1121
- ?>
1122
- 3 Comments
1123
- <?php
1124
- }
1125
-
1126
- // WooCommerce
1127
- elseif($item_key=='wc_full_price'){
1128
-
1129
- ?>
1130
- <del>$45</del> - <ins>$40</ins>
1131
- <?php
1132
- }
1133
- elseif($item_key=='wc_sale_price'){
1134
-
1135
- ?>
1136
- $45
1137
- <?php
1138
- }
1139
-
1140
- elseif($item_key=='wc_regular_price'){
1141
-
1142
- ?>
1143
- $45
1144
- <?php
1145
- }
1146
-
1147
- elseif($item_key=='wc_add_to_cart'){
1148
-
1149
- ?>
1150
- Add to Cart
1151
- <?php
1152
- }
1153
-
1154
- elseif($item_key=='wc_rating_star'){
1155
-
1156
- ?>
1157
- *****
1158
- <?php
1159
- }
1160
1161
- elseif($item_key=='wc_rating_text'){
1162
-
1163
- ?>
1164
- 2 Reviews
1165
- <?php
1166
- }
1167
- elseif($item_key=='wc_categories'){
1168
-
1169
- ?>
1170
- <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
1171
- <?php
1172
- }
1173
-
1174
- elseif($item_key=='wc_tags'){
1175
-
1176
- ?>
1177
- <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
1178
- <?php
1179
- }
1180
-
1181
- else{
1182
-
1183
- echo $item_info['name'];
1184
-
1185
- }
1186
-
1187
- ?>
1188
-
1189
-
1190
-
1191
- </div>
1192
- <?php
1193
}
1194
1195
- ?>
1196
- </div>
1197
- <?php
1198
1199
- die();
1200
1201
- }
1202
1203
- add_action('wp_ajax_post_grid_layout_hover_ajax', 'post_grid_layout_hover_ajax');
1204
- add_action('wp_ajax_nopriv_post_grid_layout_hover_ajax', 'post_grid_layout_hover_ajax');
1205
-
1206
-
1207
-
1208
-
1209
-
1210
-
1211
-
1212
-
1213
- function post_grid_layout_add_elements(){
1214
1215
- $item_key = $_POST['item_key'];
1216
- $layout = $_POST['layout'];
1217
- $unique_id = $_POST['unique_id'];
1218
-
1219
- $class_post_grid_functions = new class_post_grid_functions();
1220
- $layout_items = $class_post_grid_functions->layout_items();
1221
-
1222
-
1223
-
1224
- $html = array();
1225
- $html['item'] = '';
1226
- $html['item'].= '<div class="item '.$item_key.'" >';
1227
-
1228
-
1229
- if($item_key=='thumb'){
1230
-
1231
- $html['item'].= '<img style="width:100%;" src="'.post_grid_plugin_url.'assets/admin/images/thumb.png" />';
1232
-
1233
- }
1234
-
1235
- elseif($item_key=='thumb_link'){
1236
-
1237
- $html['item'].= '<a href="#"><img style="width:100%;" src="'.post_grid_plugin_url.'assets/admin/images/thumb.png" /></a>';
1238
-
1239
- }
1240
-
1241
-
1242
- elseif($item_key=='title'){
1243
-
1244
- $html['item'].= 'Lorem Ipsum is simply';
1245
-
1246
- }
1247
-
1248
- elseif($item_key=='title_link'){
1249
-
1250
- $html['item'].= '<a href="#">Lorem Ipsum is simply</a>';
1251
-
1252
- }
1253
-
1254
-
1255
- elseif($item_key=='excerpt'){
1256
- $html['item'].= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text';
1257
-
1258
-
1259
- }
1260
-
1261
- elseif($item_key=='excerpt_read_more'){
1262
- $html['item'].= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text <a href="#">Read more</a>';
1263
-
1264
- }
1265
-
1266
- elseif($item_key=='read_more'){
1267
- $html['item'].= '<a href="#">Read more</a>';
1268
-
1269
- }
1270
-
1271
- elseif($item_key=='post_date'){
1272
- $html['item'].= '18/06/2015';
1273
-
1274
- }
1275
-
1276
- elseif($item_key=='author'){
1277
- $html['item'].= 'PickPlugins';
1278
-
1279
- }
1280
-
1281
- elseif($item_key=='categories'){
1282
- $html['item'].= '<a hidden="#">Category 1</a> <a hidden="#">Category 2</a>';
1283
-
1284
- }
1285
-
1286
- elseif($item_key=='tags'){
1287
- $html['item'].= '<a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>';
1288
-
1289
- }
1290
-
1291
- elseif($item_key=='comments_count'){
1292
- $html['item'].= '3 Comments';
1293
-
1294
- }
1295
-
1296
- // WooCommerce
1297
- elseif($item_key=='wc_full_price'){
1298
- $html['item'].= '<del>$45</del> - <ins>$40</ins>';
1299
-
1300
- }
1301
- elseif($item_key=='wc_sale_price'){
1302
- $html['item'].= '$45';
1303
-
1304
- }
1305
-
1306
- elseif($item_key=='wc_regular_price'){
1307
- $html['item'].= '$45';
1308
-
1309
- }
1310
-
1311
- elseif($item_key=='wc_add_to_cart'){
1312
- $html['item'].= 'Add to Cart';
1313
-
1314
- }
1315
-
1316
- elseif($item_key=='wc_rating_star'){
1317
- $html['item'].= '*****';
1318
-
1319
- }
1320
-
1321
- elseif($item_key=='wc_rating_text'){
1322
- $html['item'].= '2 Reviews';
1323
-
1324
- }
1325
- elseif($item_key=='wc_categories'){
1326
- $html['item'].= '<a href="#">Category 1</a> <a href="#">Category 2</a>';
1327
-
1328
- }
1329
-
1330
- elseif($item_key=='wc_tags'){
1331
- $html['item'].= '<a href="#" >Tags 1</a> <a href="#">Tags 2</a>';
1332
-
1333
- }
1334
-
1335
- /* WP eCommerce Stuff*/
1336
-
1337
- elseif($item_key=='WPeC_old_price'){
1338
- $html['item'].= '$45';
1339
-
1340
- }
1341
-
1342
- elseif($item_key=='WPeC_sale_price'){
1343
- $html['item'].= '$40';
1344
-
1345
- }
1346
- elseif($item_key=='WPeC_add_to_cart'){
1347
- $html['item'].= 'Add to Cart';
1348
-
1349
- }
1350
-
1351
- elseif($item_key=='WPeC_rating_star'){
1352
- $html['item'].= '*****';
1353
-
1354
- }
1355
- elseif($item_key=='WPeC_categories'){
1356
- $html['item'].= '<a href="#">Category 1</a> <a href="#">Category 2</a>';
1357
-
1358
- }
1359
-
1360
-
1361
- elseif($item_key=='meta_key'){
1362
- $html['item'].= 'Meta Key';
1363
-
1364
- }
1365
1366
1367
- elseif($item_key=='html'){
1368
- $html['item'].= 'HTML';
1369
-
1370
- }
1371
1372
-
1373
-
1374
- else{
1375
-
1376
- echo '';
1377
-
1378
- }
1379
- $html['item'].= '</div>';
1380
-
1381
- $html['options'] = '';
1382
- $html['options'].= '<div class="items" id="'.$unique_id.'">';
1383
- $html['options'].= '<div class="header"><span class="remove"><i class="fa fa-times"></i></span>'.$layout_items[$item_key].'</div>';
1384
- $html['options'].= '<div class="options">';
1385
1386
- if($item_key=='meta_key'){
1387
-
1388
- $html['options'].= 'Meta Key: <br /><input type="text" value="" name="post_grid_layout_content['.$layout.']['.$unique_id.'][field_id]" /><br /><br />';
1389
- $html['options'].= 'Wrapper: <br />use %s where you want to repalce the meta value. Example<pre>&lt;div&gt;%s&lt;/div&gt;</pre> <br /><input type="text" value="%s" name="post_grid_layout_content['.$layout.']['.$unique_id.'][wrapper]" /><br /><br />';
1390
-
1391
-
1392
- }
1393
-
1394
- if($item_key=='html'){
1395
-
1396
- $html['options'].= 'Custom HTML: <br /><input type="text" value="" name="post_grid_layout_content['.$layout.']['.$unique_id.'][html]" /><br /><br />';
1397
-
1398
- }
1399
-
1400
-
1401
-
1402
- if($item_key=='read_more'){
1403
-
1404
- $html['options'].= 'Read more text: <br /><input type="text" value="" name="post_grid_layout_content['.$layout.']['.$unique_id.'][read_more_text]" /><br /><br />';
1405
- }
1406
-
1407
-
1408
-
1409
- if($item_key=='title' || $item_key=='title_link' || $item_key=='excerpt' || $item_key=='excerpt_read_more' ){
1410
-
1411
- $html['options'].= 'Character limit: <br /><input type="text" value="20" name="post_grid_layout_content['.$layout.']['.$unique_id.'][char_limit]" /><br /><br />';
1412
- }
1413
-
1414
- if($item_key=='title_link' || $item_key=='read_more' || $item_key=='excerpt_read_more' ){
1415
-
1416
- $html['options'].= 'Link target: <br />
1417
- <select name="post_grid_layout_content['.$layout.']['.$unique_id.'][link_target]" >
1418
- <option value="_blank">_blank</option>
1419
- <option value="_parent">_parent</option>
1420
- <option value="_self">_self</option>
1421
- <option value="_top">_top</option>
1422
- <option value="new">new</option>
1423
- </select><br /><br />';
1424
- }
1425
1426
1427
1428
1429
1430
1431
1432
1433
-
1434
- $html['options'].= '
1435
- <input type="hidden" value="'.$item_key.'" name="post_grid_layout_content['.$layout.']['.$unique_id.'][key]" />
1436
- <input type="hidden" value="'.$layout_items[$item_key].'" name="post_grid_layout_content['.$layout.']['.$unique_id.'][name]" />
1437
- CSS: <br />
1438
- <a target="_blank" href="http://www.pickplugins.com/demo/post-grid/sample-css-for-layout-editor/">Sample css</a><br />
1439
- <textarea class="custom_css" name="post_grid_layout_content['.$layout.']['.$unique_id.'][css]" item_id="'.$item_key.'" style="width:50%" spellcheck="false" autocapitalize="off" autocorrect="off">font-size:12px;display:block;padding:10px;</textarea><br /><br />
1440
-
1441
- CSS Hover: <br />
1442
- <textarea class="custom_css" name="post_grid_layout_content['.$layout.']['.$unique_id.'][css_hover]" item_id="'.$item_key.'" style="width:50%" spellcheck="false" autocapitalize="off" autocorrect="off"></textarea>';
1443
-
1444
-
1445
1446
1447
1448
1449
- $html['options'].= '</div>';
1450
- $html['options'].= '</div>';
1451
-
1452
-
1453
-
1454
- echo json_encode($html);
1455
1456
1457
1458
die();
@@ -1460,13 +1143,6 @@ function post_grid_layout_add_elements(){
1460
}
1461
1462
add_action('wp_ajax_post_grid_layout_add_elements', 'post_grid_layout_add_elements');
1463
- add_action('wp_ajax_nopriv_post_grid_layout_add_elements', 'post_grid_layout_add_elements');
1464
-
1465
-
1466
-
1467
-
1468
-
1469
-
1470
1471
1472
@@ -1478,14 +1154,15 @@ add_action('wp_ajax_nopriv_post_grid_layout_add_elements', 'post_grid_layout_add
1478
function post_grid_ajax_load_more(){
1479
1480
$html = '';
1481
- $post_id = (int)$_POST['grid_id'];
1482
- $per_page = (int)$_POST['per_page'];
1483
- $terms = (int)$_POST['terms'];
1484
1485
1486
include post_grid_plugin_dir.'/grid-items/variables.php';
1487
1488
- $paged = (int)$_POST['paged'];
1489
1490
include post_grid_plugin_dir.'/grid-items/query.php';
1491
@@ -1542,9 +1219,10 @@ add_action('wp_ajax_nopriv_post_grid_ajax_load_more', 'post_grid_ajax_load_more'
1542
function post_grid_ajax_search(){
1543
1544
$html = '';
1545
- $post_id = (int)$_POST['grid_id'];
1546
1547
include post_grid_plugin_dir.'/grid-items/variables.php';
1548
$keyword = sanitize_text_field($_POST['keyword']);
1549
1550
include post_grid_plugin_dir.'/grid-items/query.php';
@@ -1581,37 +1259,69 @@ add_action('wp_ajax_post_grid_ajax_search', 'post_grid_ajax_search');
1581
add_action('wp_ajax_nopriv_post_grid_ajax_search', 'post_grid_ajax_search');
1582
1583
1584
- function post_grid_active_filter(){
1585
1586
- $html = '';
1587
- $categories = $_POST['categories'];
1588
1589
- //var_dump($categories).'<br>';
1590
1591
- $html .= '<select class="" name="post_grid_meta_options[nav_top][active_filter]">';
1592
- $html .= '<option value="all">All</option>';
1593
- foreach($categories as $tax_terms){
1594
-
1595
- $tax_terms = explode(',',$tax_terms);
1596
-
1597
-
1598
- $terms_info = get_term_by('id', $tax_terms[1], $tax_terms[0]);
1599
- //var_dump($terms_info);
1600
- $html .= '<option value="'.$terms_info->slug.'">'.$terms_info->name.'</option>';
1601
1602
- }
1603
1604
- $html .= '</select>';
1605
1606
- echo $html;
1607
1608
- die();
1609
1610
}
1611
1612
1613
- add_action('wp_ajax_post_grid_active_filter', 'post_grid_active_filter');
1614
- add_action('wp_ajax_nopriv_post_grid_active_filter', 'post_grid_active_filter');
1615
1616
1617
@@ -1643,351 +1353,4 @@ add_action('wp_ajax_nopriv_post_grid_active_filter', 'post_grid_active_filter');
1643
1644
}
1645
1646
-
1647
-
1648
-
1649
- /*
1650
-
1651
- function post_grid_admin_notices()
1652
- {
1653
- $post_grid_license_key = get_option('post_grid_license_key');
1654
-
1655
- $html= '';
1656
-
1657
- if(empty($post_grid_license_key))
1658
- {
1659
- $admin_url = get_admin_url();
1660
-
1661
- $html.= '<div class="update-nag">';
1662
- $html.= 'Please activate your license for <b>'.post_grid_plugin_name.' &raquo; <a href="'.$admin_url.'edit.php?post_type=post_grid&page=post_grid_menu_license">License</a></b>';
1663
- $html.= '</div>';
1664
- }
1665
- else
1666
- {
1667
-
1668
- }
1669
-
1670
- echo $html;
1671
- }
1672
-
1673
- add_action('admin_notices', 'post_grid_admin_notices');
1674
-
1675
- */
1676
-
1677
-
1678
-
1679
-
1680
-
1681
-
1682
-
1683
-
1684
-
1685
- function post_grid_upgrade_notice()
1686
- {
1687
- $post_grid_upgrade = get_option('post_grid_upgrade');
1688
-
1689
-
1690
- $html= '';
1691
-
1692
- if(($post_grid_upgrade == 'done') || (version_compare(post_grid_version, '3.0.0') >= 0) )
1693
- {
1694
-
1695
- }
1696
- else{
1697
- $html.= '<div class="update-nag">';
1698
- $html.='Data update required for Post grid latest version. <span id="post-grid-upgrade">Click to update</span>';
1699
- $html.= '</div>';
1700
- }
1701
-
1702
-
1703
- echo $html;
1704
- }
1705
-
1706
- add_action('admin_notices', 'post_grid_upgrade_notice');
1707
-
1708
-
1709
-
1710
-
1711
-
1712
- function post_grid_upgrade_action()
1713
- {
1714
- $post_grid_upgrade = get_option('post_grid_upgrade');
1715
- if($post_grid_upgrade=='done' ){
1716
-
1717
- }
1718
- else{
1719
- $wp_query = new WP_Query(
1720
- array (
1721
- 'post_type' => 'post_grid',
1722
- 'post_status' => 'publish',
1723
-
1724
- ) );
1725
-
1726
-
1727
- if ( $wp_query->have_posts() ) :
1728
- while ( $wp_query->have_posts() ) : $wp_query->the_post();
1729
-
1730
- $post_grid_themes = get_post_meta( get_the_ID(), 'post_grid_themes', true );
1731
-
1732
- if($post_grid_themes=='mixit' || $post_grid_themes=='isotope' || $post_grid_themes=='isotope-lite'){
1733
- $filter = 'yes';
1734
- }
1735
- else{
1736
- $filter = 'no';
1737
- }
1738
-
1739
-
1740
-
1741
- $post_grid_masonry_enable = get_post_meta( get_the_ID(), 'post_grid_masonry_enable', true );
1742
-
1743
- $post_grid_bg_img = get_post_meta( get_the_ID(), 'post_grid_bg_img', true );
1744
- $post_grid_thumb_size = get_post_meta( get_the_ID(), 'post_grid_thumb_size', true );
1745
- $post_grid_empty_thumb = get_post_meta( get_the_ID(), 'post_grid_empty_thumb', true );
1746
-
1747
- $post_grid_post_per_page = get_post_meta( get_the_ID(), 'post_grid_post_per_page', true );
1748
- $post_grid_pagination_display = get_post_meta( get_the_ID(), 'post_grid_pagination_display', true );
1749
-
1750
- if($post_grid_pagination_display=='no'){
1751
-
1752
- $post_grid_pagination_display='none';
1753
- }
1754
-
1755
-
1756
- $post_grid_excerpt_count = get_post_meta( get_the_ID(), 'post_grid_excerpt_count', true );
1757
- $post_grid_read_more_text = get_post_meta( get_the_ID(), 'post_grid_read_more_text', true );
1758
- $post_grid_exclude_post_id = get_post_meta( get_the_ID(), 'post_grid_exclude_post_id', true );
1759
-
1760
- $post_grid_bg_img = get_post_meta( get_the_ID(), 'post_grid_bg_img', true );
1761
-
1762
- $post_grid_items_width = get_post_meta( get_the_ID(), 'post_grid_items_width', true );
1763
- $post_grid_items_width_mobile = get_post_meta( get_the_ID(), 'post_grid_items_width_mobile', true );
1764
- $post_grid_thumb_height = get_post_meta( get_the_ID(), 'post_grid_thumb_height', true );
1765
-
1766
- $post_grid_query_order = get_post_meta( get_the_ID(), 'post_grid_query_order', true );
1767
- $post_grid_query_orderby = get_post_meta( get_the_ID(), 'post_grid_query_orderby', true );
1768
-
1769
- $post_grid_posttype = get_post_meta( get_the_ID(), 'post_grid_posttype', true );
1770
- $post_grid_taxonomy = get_post_meta( get_the_ID(), 'post_grid_taxonomy', true );
1771
- $post_grid_taxonomy_category = get_post_meta( get_the_ID(), 'post_grid_taxonomy_category', true );
1772
-
1773
- if(!empty($post_grid_taxonomy_category)){
1774
-
1775
- $i= 0;
1776
- foreach($post_grid_taxonomy_category as $term){
1777
-
1778
- $terms[$i] = $post_grid_taxonomy.','.$term;
1779
- $i++;
1780
- }
1781
- $post_grid_taxonomy_category = $terms;
1782
- }
1783
- else{
1784
- $post_grid_taxonomy_category = array();
1785
- }
1786
-
1787
-
1788
- $post_grid_meta_author_display = get_post_meta( get_the_ID(), 'post_grid_meta_author_display', true );
1789
- $post_grid_meta_avatar_display = get_post_meta( get_the_ID(), 'post_grid_meta_avatar_display', true );
1790
- $post_grid_meta_date_display = get_post_meta( get_the_ID(), 'post_grid_meta_date_display', true );
1791
- $post_grid_meta_categories_display = get_post_meta( get_the_ID(), 'post_grid_meta_categories_display', true );
1792
- $post_grid_meta_tags_display = get_post_meta( get_the_ID(), 'post_grid_meta_tags_display', true );
1793
- $post_grid_meta_comments_display = get_post_meta( get_the_ID(), 'post_grid_meta_comments_display', true );
1794
-
1795
-
1796
-
1797
- $post_grid_items = get_post_meta( get_the_ID(), 'post_grid_items', true );
1798
- $post_grid_wrapper = get_post_meta( get_the_ID(), 'post_grid_wrapper', true );
1799
- $post_grid_before_after = get_post_meta( get_the_ID(), 'post_grid_before_after', true );
1800
- $post_grid_items_display = get_post_meta( get_the_ID(), 'post_grid_items_display', true );
1801
-
1802
- $post_grid_post_title_linked = get_post_meta( get_the_ID(), 'post_grid_post_title_linked', true );
1803
- $post_grid_post_thumbnail_linked = get_post_meta( get_the_ID(), 'post_grid_post_thumbnail_linked', true );
1804
- $post_grid_post_thumbnail_external = get_post_meta( get_the_ID(), 'post_grid_post_thumbnail_external', true );
1805
-
1806
- $post_grid_hover_items_zoom_display = get_post_meta( get_the_ID(), 'post_grid_hover_items_zoom_display', true );
1807
- $post_grid_hover_items_link_display = get_post_meta( get_the_ID(), 'post_grid_hover_items_link_display', true );
1808
- $post_grid_hover_items_share_display = get_post_meta( get_the_ID(), 'post_grid_hover_items_share_display', true );
1809
-
1810
- $post_grid_title_color = get_post_meta( get_the_ID(), 'post_grid_title_color', true );
1811
- $post_grid_title_font_size = get_post_meta( get_the_ID(), 'post_grid_title_font_size', true );
1812
-
1813
- $post_grid_content_color = get_post_meta( get_the_ID(), 'post_grid_content_color', true );
1814
- $post_grid_content_font_size = get_post_meta( get_the_ID(), 'post_grid_content_font_size', true );
1815
-
1816
- $post_grid_hover_items_hover_effect_in = get_post_meta( get_the_ID(), 'post_grid_hover_items_hover_effect_in', true );
1817
-
1818
- $post_grid_mixitup_post_per_page = get_post_meta( get_the_ID(), 'post_grid_mixitup_post_per_page', true );
1819
- $post_grid_mixitup_default_filter = get_post_meta( get_the_ID(), 'post_grid_mixitup_default_filter', true );
1820
-
1821
- $terms_info = get_term_by('slug', $post_grid_mixitup_default_filter, $post_grid_taxonomy);
1822
-
1823
- $post_grid_mixitup_default_filter = $terms_info->term_id;
1824
-
1825
- $post_grid_custom_css = get_post_meta( get_the_ID(), 'post_grid_custom_css', true ); /*ok*/
1826
-
1827
-
1828
-
1829
-
1830
-
1831
- /*
1832
-
1833
- $post_grid_meta_options = array(
1834
-
1835
- 'post_types'=>$post_grid_posttype,
1836
- 'categories'=>$post_grid_taxonomy_category,
1837
- 'categories_relation'=>'OR',
1838
- 'post_status'=>array('publish'),
1839
- 'offset'=>0,
1840
- 'posts_per_page'=>$post_grid_post_per_page,
1841
- 'exclude_post_id'=>$post_grid_exclude_post_id,
1842
- 'query_order'=>$post_grid_query_order,
1843
- 'query_orderby'=>array($post_grid_query_orderby),
1844
- 'query_orderby_meta_key'=>'',
1845
- 'meta_query'=>array(),
1846
- 'meta_query_relation'=>'OR',
1847
- 'keyword'=>'',
1848
- 'layout'=>array(
1849
- 'content'=>'flat',
1850
- 'hover'=>'flat',
1851
- ),
1852
-
1853
- 'skin'=>'flat',
1854
- 'custom_js'=>'',
1855
- 'custom_css'=>$post_grid_custom_css,
1856
- 'width'=>array(
1857
- 'desktop'=>$post_grid_items_width,
1858
- 'tablet'=>$post_grid_items_width,
1859
- 'mobile'=>$post_grid_items_width_mobile,
1860
- ),
1861
-
1862
- 'height'=>array(
1863
- 'style'=>'auto_height',
1864
- 'fixed_height'=>$post_grid_thumb_height,
1865
- ),
1866
- 'media_source'=>array(
1867
- 'featured_image' => array ('id' => 'featured_image','title' => 'Featured Image','checked' => 'yes',),
1868
- 'first_image' => array ('id' => 'first_image','title' => 'First images from content','checked' => 'yes',),
1869
- 'first_gallery' => array ('id' => 'first_gallery','title' => 'First gallery from content','checked' => 'yes',),
1870
- 'first_youtube' => array ('id' => 'first_youtube','title' => 'First youtube video from content','checked' => 'yes',),
1871
- 'first_vimeo' => array ('id' => 'first_vimeo','title' => 'First vimeo video from content','checked' => 'yes',),
1872
- 'first_mp3' => array ('id' => 'first_mp3','title' => 'First MP3 from content','checked' => 'yes',),
1873
- 'first_soundcloud' => array ('id' => 'first_soundcloud','title' => 'First SoundCloud from content','checked' => 'yes',),
1874
- 'empty_thumb' => array ('id' => 'empty_thumb','title' => 'Empty thumbnail','checked' => 'yes',),
1875
- ),
1876
- 'featured_img_size'=>$post_grid_thumb_size,
1877
- 'margin'=>'5px',
1878
-
1879
- 'container'=>array(
1880
- 'padding'=>'10px',
1881
- 'bg_color'=>'',
1882
- 'bg_image'=>$post_grid_bg_img,
1883
- ),
1884
-
1885
-
1886
- 'nav_top'=>array(
1887
- 'filter'=>$filter,
1888
- 'active_filter'=>$post_grid_mixitup_default_filter,
1889
- 'search'=>'none',
1890
- ),
1891
-
1892
- 'nav_bottom'=>array(
1893
- 'pagination_type'=>$post_grid_pagination_display,
1894
- 'pagination_theme'=>'lite',
1895
- ),
1896
-
1897
-
1898
- );
1899
-
1900
- */
1901
-
1902
-
1903
- $post_grid_meta_options = array(
1904
-
1905
- 'post_types'=>'',
1906
- 'categories'=>'',
1907
- 'categories_relation'=>'OR',
1908
- 'post_status'=>array('publish'),
1909
- 'offset'=>0,
1910
- 'posts_per_page'=>'',
1911
- 'exclude_post_id'=>'',
1912
- 'query_order'=>'',
1913
- 'query_orderby'=>array(),
1914
- 'query_orderby_meta_key'=>'',
1915
- 'meta_query'=>array(),
1916
- 'meta_query_relation'=>'OR',
1917
- 'keyword'=>'',
1918
- 'layout'=>array(
1919
- 'content'=>'flat',
1920
- 'hover'=>'flat',
1921
- ),
1922
-
1923
- 'skin'=>'flat',
1924
- 'custom_js'=>'',
1925
- 'custom_css'=>'',
1926
- 'width'=>array(
1927
- 'desktop'=>'',
1928
- 'tablet'=>'',
1929
- 'mobile'=>'',
1930
- ),
1931
-
1932
- 'height'=>array(
1933
- 'style'=>'auto_height',
1934
- 'fixed_height'=>'',
1935
- ),
1936
- 'media_source'=>array(
1937
- 'featured_image' => array ('id' => 'featured_image','title' => 'Featured Image','checked' => 'yes',),
1938
- 'first_image' => array ('id' => 'first_image','title' => 'First images from content','checked' => 'yes',),
1939
- 'first_gallery' => array ('id' => 'first_gallery','title' => 'First gallery from content','checked' => 'yes',),
1940
- 'first_youtube' => array ('id' => 'first_youtube','title' => 'First youtube video from content','checked' => 'yes',),
1941
- 'first_vimeo' => array ('id' => 'first_vimeo','title' => 'First vimeo video from content','checked' => 'yes',),
1942
- 'first_mp3' => array ('id' => 'first_mp3','title' => 'First MP3 from content','checked' => 'yes',),
1943
- 'first_soundcloud' => array ('id' => 'first_soundcloud','title' => 'First SoundCloud from content','checked' => 'yes',),
1944
- 'empty_thumb' => array ('id' => 'empty_thumb','title' => 'Empty thumbnail','checked' => 'yes',),
1945
- ),
1946
- 'featured_img_size'=>'',
1947
- 'margin'=>'5px',
1948
-
1949
- 'container'=>array(
1950
- 'padding'=>'10px',
1951
- 'bg_color'=>'',
1952
- 'bg_image'=>'',
1953
- ),
1954
-
1955
-
1956
- 'nav_top'=>array(
1957
- 'filter'=>'',
1958
- 'active_filter'=>'',
1959
- 'search'=>'none',
1960
- ),
1961
-
1962
- 'nav_bottom'=>array(
1963
- 'pagination_type'=>'',
1964
- 'pagination_theme'=>'lite',
1965
- ),
1966
-
1967
-
1968
- );
1969
-
1970
-
1971
-
1972
-
1973
-
1974
-
1975
- update_post_meta(get_the_ID(), 'post_grid_meta_options', $post_grid_meta_options );
1976
-
1977
- endwhile;
1978
- wp_reset_query();
1979
- endif;
1980
-
1981
- }
1982
-
1983
- update_option('post_grid_upgrade','done');
1984
- die();
1985
-
1986
- }
1987
-
1988
-
1989
-
1990
- add_action('wp_ajax_post_grid_upgrade_action', 'post_grid_upgrade_action');
1991
- add_action('wp_ajax_nopriv_post_grid_upgrade_action', 'post_grid_upgrade_action');
1992
-
1993
<
8
if ( ! defined('ABSPATH')) exit; // if direct access
9
10
11
12
13
14
15
16
17
18
19
29
if ($column == 'shortcode'){
30
?>
31
<input style="background:#bfefff" type="text" onClick="this.select();" value="[post_grid <?php echo 'id=&quot;'.$post_id.'&quot;';?>]" /><br />
32
+ <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[post_grid id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea>
33
<?php
34
35
}
530
531
function post_grid_remove_content_layout_ajax(){
532
533
+ if(current_user_can('manage_options')){
534
+
535
+ $layout_id = sanitize_text_field($_POST['layout_id']);
536
537
$post_grid_layout_content = get_option('post_grid_layout_content');
538
+ unset($post_grid_layout_content[$layout_id]);
539
540
+ update_option('post_grid_layout_content',$post_grid_layout_content);
541
542
}
543
544
die();
545
+
546
}
547
548
+ add_action('wp_ajax_post_grid_remove_content_layout_ajax', 'post_grid_remove_content_layout_ajax');
549
550
551
552
553
554
+ function post_grid_reset_content_layouts(){
555
556
+ if(current_user_can('manage_options')){
557
558
+ $class_post_grid_functions = new class_post_grid_functions();
559
+ $layout_content_list = $class_post_grid_functions->layout_content_list();
560
+ update_option('post_grid_layout_content', $layout_content_list);
561
562
+ }
563
564
die();
565
}
566
567
568
+ add_action('wp_ajax_post_grid_reset_content_layouts', 'post_grid_reset_content_layouts');
569
570
571
572
573
575
576
577
function post_grid_term_slug_list($post_id){
578
+
579
+
580
$term_slug_list = '';
581
582
$post_taxonomies = get_post_taxonomies($post_id);
662
663
$html .= '</select>';
664
return $html;
665
+
666
+
667
}
668
669
673
674
function post_grid_layout_content_ajax(){
675
676
+ if(current_user_can('manage_options')){
677
678
+ $layout_key = sanitize_text_field($_POST['layout']);
679
+
680
+ $class_post_grid_functions = new class_post_grid_functions();
681
+
682
+
683
+ $post_grid_layout_content = get_option( 'post_grid_layout_content' );
684
+
685
+ if(empty($post_grid_layout_content)){
686
+ $layout = $class_post_grid_functions->layout_content($layout_key);
687
+ }
688
+ else{
689
+ $layout = $post_grid_layout_content[$layout_key];
690
691
+ }
692
+
693
+ //$layout = $class_post_grid_functions->layout_content($layout_key);
694
+
695
+
696
+
697
+ ?>
698
+ <div class="<?php echo $layout_key; ?>">
699
+ <?php
700
+
701
+ foreach($layout as $item_key=>$item_info){
702
+ $item_key = $item_info['key'];
703
+ ?>
704
705
+
706
+ <div class="item <?php echo $item_key; ?>" style=" <?php echo $item_info['css']; ?> ">
707
708
<?php
709
710
+ if($item_key=='thumb'){
711
+
712
+ ?>
713
+ <img src="<?php echo post_grid_plugin_url; ?>assets/admin/images/thumb.png" />
714
+ <?php
715
+ }
716
+
717
+ elseif($item_key=='title'){
718
+
719
+ ?>
720
+ Lorem Ipsum is simply
721
+
722
+ <?php
723
+ }
724
+
725
+ elseif($item_key=='excerpt'){
726
+
727
+ ?>
728
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text
729
+ <?php
730
+ }
731
+
732
+ elseif($item_key=='excerpt_read_more'){
733
+
734
+ ?>
735
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text <a href="#">Read more</a>
736
+ <?php
737
+ }
738
+
739
+ elseif($item_key=='read_more'){
740
+
741
+ ?>
742
+ <a href="#">Read more</a>
743
+ <?php
744
+ }
745
+
746
+ elseif($item_key=='post_date'){
747
+
748
+ ?>
749
+ 18/06/2015
750
+ <?php
751
+ }
752
+
753
+ elseif($item_key=='author'){
754
+
755
+ ?>
756
+ PickPlugins
757
+ <?php
758
+ }
759
+
760
+ elseif($item_key=='categories'){
761
+
762
+ ?>
763
+ <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
764
+ <?php
765
+ }
766
+
767
+ elseif($item_key=='tags'){
768
+
769
+ ?>
770
+ <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
771
+ <?php
772
+ }
773
+
774
+ elseif($item_key=='comments_count'){
775
+
776
+ ?>
777
+ 3 Comments
778
+ <?php
779
+ }
780
+
781
+ // WooCommerce
782
+ elseif($item_key=='wc_full_price'){
783
+
784
+ ?>
785
+ <del>$45</del> - <ins>$40</ins>
786
+ <?php
787
+ }
788
+ elseif($item_key=='wc_sale_price'){
789
+
790
+ ?>
791
+ $45
792
+ <?php
793
+ }
794
795
+ elseif($item_key=='wc_regular_price'){
796
+
797
+ ?>
798
+ $45
799
+ <?php
800
+ }
801
+
802
+ elseif($item_key=='wc_add_to_cart'){
803
+
804
+ ?>
805
+ Add to Cart
806
+ <?php
807
+ }
808
+
809
+ elseif($item_key=='wc_rating_star'){
810
+
811
+ ?>
812
+ *****
813
+ <?php
814
+ }
815
+
816
+ elseif($item_key=='wc_rating_text'){
817
+
818
+ ?>
819
+ 2 Reviews
820
+ <?php
821
+ }
822
+ elseif($item_key=='wc_categories'){
823
+
824
+ ?>
825
+ <a hidden="#">Category 1</a> <a hidden="#">Category 2</a>
826
+ <?php
827
+ }
828
+
829
+ elseif($item_key=='wc_tags'){
830
+
831
+ ?>
832
+ <a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>
833
+ <?php
834
+ }
835
+
836
+ elseif($item_key=='edd_price'){
837
+
838
+ ?>
839
+ $45
840
+ <?php
841
+ }
842
+
843
+
844
+ else{
845
+
846
+ echo $item_info['name'];
847
+
848
+ }
849
850
?>
851
852
853
854
+ </div>
855
<?php
856
+ }
857
+
858
+ ?>
859
+ </div>
860
+ <?php
861
+
862
+
863
+
864
+
865
+
866
+ }
867
+
868
869
+
870
+ die();
871
+
872
+ }
873
+
874
+ add_action('wp_ajax_post_grid_layout_content_ajax', 'post_grid_layout_content_ajax');
875
876
877
883
884
885
886
+ function post_grid_layout_add_elements(){
887
+
888
+
889
+ if(current_user_can('manage_options')){
890
891
+
892
+ $item_key = sanitize_text_field($_POST['item_key']);
893
+ $layout = sanitize_text_field($_POST['layout']);
894
+ $unique_id = sanitize_text_field($_POST['unique_id']);
895
896
+ $class_post_grid_functions = new class_post_grid_functions();
897
+ $layout_items = $class_post_grid_functions->layout_items();
898
899
900
901
+ $html = array();
902
+ $html['item'] = '';
903
+ $html['item'].= '<div class="item '.$item_key.'" >';
904
+
905
+
906
+ if($item_key=='thumb'){
907
908
+ $html['item'].= '<img style="width:100%;" src="'.post_grid_plugin_url.'assets/admin/images/thumb.png" />';
909
+
910
+ }
911
912
+ elseif($item_key=='thumb_link'){
913
+
914
+ $html['item'].= '<a href="#"><img style="width:100%;" src="'.post_grid_plugin_url.'assets/admin/images/thumb.png" /></a>';
915
+
916
+ }
917
+
918
+
919
+ elseif($item_key=='title'){
920
+
921
+ $html['item'].= 'Lorem Ipsum is simply';
922
+
923
+ }
924
+
925
+ elseif($item_key=='title_link'){
926
+
927
+ $html['item'].= '<a href="#">Lorem Ipsum is simply</a>';
928
+
929
+ }
930
931
+
932
+ elseif($item_key=='excerpt'){
933
+ $html['item'].= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text';
934
+
935
+
936
+ }
937
+
938
+ elseif($item_key=='excerpt_read_more'){
939
+ $html['item'].= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text <a href="#">Read more</a>';
940
+
941
+ }
942
+
943
+ elseif($item_key=='read_more'){
944
+ $html['item'].= '<a href="#">Read more</a>';
945
+
946
+ }
947
+
948
+ elseif($item_key=='post_date'){
949
+ $html['item'].= '18/06/2015';
950
+
951
+ }
952
+
953
+ elseif($item_key=='author'){
954
+ $html['item'].= 'PickPlugins';
955
+
956
+ }
957
+
958
+ elseif($item_key=='categories'){
959
+ $html['item'].= '<a hidden="#">Category 1</a> <a hidden="#">Category 2</a>';
960
+
961
}
962
+
963
+ elseif($item_key=='tags'){
964
+ $html['item'].= '<a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>';
965
966
+ }
967
+
968
+ elseif($item_key=='comments_count'){
969
+ $html['item'].= '3 Comments';
970
971
+ }
972
+
973
+ // WooCommerce
974
+ elseif($item_key=='wc_full_price'){
975
+ $html['item'].= '<del>$45</del> - <ins>$40</ins>';
976
977
+ }
978
+ elseif($item_key=='wc_sale_price'){
979
+ $html['item'].= '$45';
980
981
+ }
982
+
983
+ elseif($item_key=='wc_regular_price'){
984
+ $html['item'].= '$45';
985
986
+ }