Post Grid - Version 2.0.55

Version Description

  • 2020-05-4 fix - remove empty read more text to avoid conflict old layout.
    • 2020-05-15 add - Element added for "kk Star Ratings" plugin
    • 2020-05-15 add - Element added for "Multi Rating" plugin
    • 2020-05-15 add - Element added for "Rate my Post" plugin
    • 2020-05-15 add - Element added for "Rating-Widget" plugin
    • 2020-05-15 add - Element added for "WP-PostRatings" plugin
    • 2020-05-15 add - Elements visitor votes, overall rating added for "Yasr Yet Another Stars Rating" plugin
    • 2020-05-15 add - Element added for "YITH - Add to Wishlist" plugin
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Post Grid
Version 2.0.55
Comparing to
See all releases

Code changes from version 2.0.54 to 2.0.55

assets/frontend/css/style.css CHANGED
@@ -224,75 +224,6 @@
224
225
/*Grid Element CSS*/
226
227
- .post-grid .element.wc_add_to_cart {}
228
- .post-grid .element.wc_add_to_cart p {
229
- border: medium none !important;
230
- margin: 0 !important;
231
- padding: 0 !important;
232
- }
233
-
234
-
235
- .post-grid .element.wc_gallery {}
236
- .post-grid .element.wc_gallery img {
237
- border-radius: 0;
238
- box-shadow: none;
239
- display: inline-block;
240
- margin: 5px;
241
- vertical-align: top;
242
- width: 50px;
243
- }
244
-
245
- .post-grid .element.wc_full_price {}
246
- .post-grid .element.wc_full_price ins {
247
- background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
248
- }
249
-
250
-
251
-
252
- .post-grid .share_button span {
253
- display: inline-block;
254
- margin: 3px;
255
-
256
- }
257
-
258
-
259
- .post-grid .share_button span a {
260
- display: inline-block;
261
- font-size: 25px;
262
- }
263
-
264
-
265
-
266
- .post-grid .zoom {
267
- background: #fff none repeat scroll 0 0;
268
- border-radius: 50%;
269
- box-shadow: 0 0 3px 0 rgb(153, 153, 153);
270
- cursor: pointer;
271
- display: inline;
272
- height: 50px;
273
- line-height: normal;
274
- text-align: center;
275
- width: 50px;
276
- }
277
-
278
- .post-grid .zoom .fa {
279
- color: #999;
280
- font-size: 24px;
281
- margin-top: 12px;
282
- }
283
-
284
- .post-grid .comments-area {
285
-
286
- }
287
-
288
- .post-grid .commentlist {
289
-
290
- }
291
-
292
- .post-grid .commentlist li {
293
- list-style: outside none none;
294
- margin: 0;
295
- }
296
297
298
/*Lazy Load*/
224
225
/*Grid Element CSS*/
226
227
228
229
/*Lazy Load*/
includes/class-metabox-post-grid-layout-hook.php CHANGED
@@ -110,6 +110,8 @@ if(!function_exists('post_grid_layout_metabox_content_layout_builder')){
110
111
<?php
112
113
$elements_group['general'] = array(
114
'group_title'=>'General',
115
'items'=>array(
@@ -142,21 +144,16 @@ if(!function_exists('post_grid_layout_metabox_content_layout_builder')){
142
),
143
);
144
145
- //
146
-
147
- //
148
-
149
- //
150
-
151
-
152
-
153
-
154
- //$elements_group['events_manager'] = array('group_title'=>'Events manager');
155
- //$elements_group['yith'] = array('group_title'=>'Yith');
156
-
157
-
158
159
160
161
$elements_group = apply_filters('post_grid_layout_elements', $elements_group);
162
@@ -165,7 +162,9 @@ if(!function_exists('post_grid_layout_metabox_content_layout_builder')){
165
166
if(!empty($elements_group))
167
foreach ($elements_group as $group_index => $element_group):
168
- $group_items = $element_group['items'];
169
170
foreach ($group_items as $elementIndex => $element):
171
ob_start();
@@ -209,9 +208,11 @@ if(!function_exists('post_grid_layout_metabox_content_layout_builder')){
209
if(!empty($elements_group))
210
foreach ($elements_group as $group_index => $element_group):
211
212
- $group_title = $element_group['group_title'];
213
- $group_items = $element_group['items'];
214
215
?>
216
<div class="item">
217
<div class="element-title header ">
110
111
<?php
112
113
+
114
+
115
$elements_group['general'] = array(
116
'group_title'=>'General',
117
'items'=>array(
144
),
145
);
146
147
148
+ $elements_group['star_rating'] = array(
149
+ 'group_title'=>'Star Rating',
150
+ 'items'=>array(),
151
+ );
152
153
+ $elements_group['wishlist'] = array(
154
+ 'group_title'=>'Wishlist',
155
+ 'items'=>array(),
156
+ );
157
158
$elements_group = apply_filters('post_grid_layout_elements', $elements_group);
159
162
163
if(!empty($elements_group))
164
foreach ($elements_group as $group_index => $element_group):
165
+
166
+
167
+ $group_items = isset($element_group['items']) ? $element_group['items'] : array();
168
169
foreach ($group_items as $elementIndex => $element):
170
ob_start();
208
if(!empty($elements_group))
209
foreach ($elements_group as $group_index => $element_group):
210
211
+ $group_title = isset($element_group['group_title']) ? $element_group['group_title'] : '';
212
+ $group_items = isset($element_group['items']) ? $element_group['items'] : array();
213
+ //$group_items = apply_filters('post_grid_layout_group_'.$group_index, $group_items);
214
215
+ if(empty($group_items)) continue;
216
?>
217
<div class="item">
218
<div class="element-title header ">
includes/class-settings-tabs.php CHANGED
@@ -1671,6 +1671,7 @@ class settings_tabs_field{
1671
.radio-img img{
1672
1673
vertical-align: top;
1674
}
1675
1676
</style>
1671
.radio-img img{
1672
1673
vertical-align: top;
1674
+ width: 100%;
1675
}
1676
1677
</style>
includes/classes/class-post-grid-support.php CHANGED
@@ -65,155 +65,205 @@ class class_post_grid_support{
65
66
$tutorials = array(
67
array(
68
- 'question'=>__('Latest Version 2.0.46 Overview', 'post-grid'),
69
- 'answer_url'=>'https://youtu.be/YVtsIbEb9zs',
70
),
71
72
array(
73
- 'question'=>__('How to create post grid', 'post-grid'),
74
- 'answer_url'=>'https://www.youtube.com/watch?v=g5kxtJIopXs',
75
),
76
array(
77
- 'question'=>__('Custom read more text', 'post-grid'),
78
- 'answer_url'=>'https://www.youtube.com/watch?v=LY7IjS7SFNk',
79
),
80
array(
81
- 'question'=>__('Remove read more text', 'post-grid'),
82
- 'answer_url'=>'https://www.youtube.com/watch?v=ZcS2vRcTe4A',
83
),
84
array(
85
- 'question'=>__('Excerpt word count', 'post-grid'),
86
- 'answer_url'=>'https://www.youtube.com/watch?v=gZ6E3UiKQqk',
87
),
88
89
array(
90
- 'question'=>__('Custom media height', 'post-grid'),
91
- 'answer_url'=>'https://www.youtube.com/watch?v=TupF2TpHHFA',
92
),
93
array(
94
- 'question'=>__('Item custom padding margin', 'post-grid'),
95
- 'answer_url'=>'https://www.youtube.com/watch?v=HRZpoib1VvI',
96
),
97
array(
98
- 'question'=>__('Grid item height', 'post-grid'),
99
- 'answer_url'=>'https://www.youtube.com/watch?v=ydqlgzfsboQ',
100
),
101
array(
102
- 'question'=>__('Column Width or column number', 'post-grid'),
103
- 'answer_url'=>'https://www.youtube.com/watch?v=ZV8hd1ij5Wo',
104
),
105
array(
106
- 'question'=>__('Post title linked', 'post-grid'),
107
- 'answer_url'=>'https://www.youtube.com/watch?v=oUVZB9F5d4U',
108
),
109
array(
110
- 'question'=>__('Featured image linked to post', 'post-grid'),
111
- 'answer_url'=>'https://www.youtube.com/watch?v=stGOJLwUF-k',
112
),
113
array(
114
- 'question'=>__('Query post by categories or terms', 'post-grid'),
115
- 'answer_url'=>'https://www.youtube.com/watch?v=xYzqtWRg8W4',
116
),
117
array(
118
- 'question'=>__('Query post by tags or terms', 'post-grid'),
119
- 'answer_url'=>'https://www.youtube.com/watch?v=RKb-B_Q72Ak',
120
),
121
array(
122
- 'question'=>__('Display search input', 'post-grid'),
123
- 'answer_url'=>'https://www.youtube.com/watch?v=psJR65Fmc_s',
124
),
125
array(
126
- 'question'=>__('Work with layout editor', 'post-grid'),
127
- 'answer_url'=>'https://www.youtube.com/watch?v=9bQc7q40jMc',
128
),
129
array(
130
- 'question'=>__('[ Pro ] Create filterable grid', 'post-grid'),
131
- 'answer_url'=>'https://www.youtube.com/watch?v=Zg2r7idmEm0',
132
),
133
array(
134
- 'question'=>__('[ Pro ] Filterable custom filter type data logic', 'post-grid'),
135
- 'answer_url'=>'https://www.youtube.com/watch?v=5Dueav6Yoyc',
136
),
137
138
array(
139
- 'question'=>__('[ Pro ] Filterable custom all text', 'post-grid'),
140
- 'answer_url'=>'https://www.youtube.com/watch?v=JvVkAyoXC3g',
141
),
142
array(
143
- 'question'=>__('[ Pro ] Filterable default active filter', 'post-grid'),
144
- 'answer_url'=>'https://www.youtube.com/watch?v=h2rbyZNhMhU',
145
),
146
147
array(
148
- 'question'=>__('[ Pro ] Filterable custom filter', 'post-grid'),
149
- 'answer_url'=>'https://www.youtube.com/watch?v=e8phxNKIRsU',
150
),
151
152
array(
153
- 'question'=>__('[ Pro ] Filterable dropdown single filter', 'post-grid'),
154
- 'answer_url'=>'https://www.youtube.com/watch?v=ZHY8qf-z3H0',
155
),
156
157
array(
158
- 'question'=>__('[ Pro ] Filterable display sort filter', 'post-grid'),
159
- 'answer_url'=>'https://www.youtube.com/watch?v=21TYNsp2OPI',
160
),
161
162
array(
163
- 'question'=>__('[ Pro ] Filterable multi filter', 'post-grid'),
164
- 'answer_url'=>'https://www.youtube.com/watch?v=uRcfd_R9YCM',
165
),
166
167
168
169
array(
170
- 'question'=>__('[ Pro ] Post grid on archive tags', 'post-grid'),
171
- 'answer_url'=>'https://youtu.be/lNyAjva_UXo',
172
),
173
174
175
176
177
array(
178
- 'question'=>__('[ Pro ] Query post by meta field', 'post-grid'),
179
- 'answer_url'=>'https://www.youtube.com/watch?v=0AIDNJvZGR0',
180
),
181
182
183
array(
184
- 'question'=>__('[ Pro ] Multi skin', 'post-grid'),
185
- 'answer_url'=>'https://www.youtube.com/watch?v=YzUs_P3cFCo',
186
),
187
array(
188
- 'question'=>__('[ Pro ] Sticky post query', 'post-grid'),
189
- 'answer_url'=>'https://www.youtube.com/watch?v=nVIOUbVjML4',
190
),
191
array(
192
- 'question'=>__('[ Pro ] Masonry layout', 'post-grid'),
193
- 'answer_url'=>'https://www.youtube.com/watch?v=qYjbv2euNpE',
194
),
195
array(
196
- 'question'=>__('[ Pro ] Post query by author', 'post-grid'),
197
- 'answer_url'=>'https://www.youtube.com/watch?v=KtoGa8NB3ig',
198
),
199
array(
200
- 'question'=>__('[ Pro ] Create glossary grid', 'post-grid'),
201
- 'answer_url'=>'https://www.youtube.com/watch?v=MKL4EZ-WYTs',
202
),
203
array(
204
- 'question'=>__('[ Pro ] Post carousel slider', 'post-grid'),
205
- 'answer_url'=>'https://www.youtube.com/watch?v=A0bZ_luBtQQ',
206
),
207
208
array(
209
- 'question'=>__('[ Pro ] Grid layout type', 'post-grid'),
210
- 'answer_url'=>'https://www.youtube.com/watch?v=58piQVkDZN4',
211
),
212
array(
213
- 'question'=>__('[ Pro ] Thumbnail youtube', 'post-grid'),
214
- 'answer_url'=>'https://www.youtube.com/watch?v=Zm5vD15yvNM',
215
),
216
217
218
);
219
@@ -227,30 +277,7 @@ class class_post_grid_support{
227
228
public function faq(){
229
$faq = array(
230
- array(
231
- 'question'=>__('How to Create a Post Grid?', 'post-grid'),
232
- 'answer_url'=>'https://www.pickplugins.com/documentation/post-grid/faq/how-to-create-a-post-grid/',
233
- ),
234
- array(
235
- 'question'=>__('How to upgrade to premium?', 'post-grid'),
236
- 'answer_url'=>'https://www.pickplugins.com/documentation/post-grid/upgrade-to-premium/',
237
- ),
238
-
239
- // array(
240
- // 'question'=>__('How to activate license?', 'post-grid'),
241
- // 'answer_url'=>'https://www.pickplugins.com/documentation/woocommerce-products-slider/faq/activate-license/',
242
- // ),
243
-
244
- array(
245
- 'question'=>__('Post grid on archive page?', 'post-grid'),
246
- 'answer_url'=>'https://www.pickplugins.com/documentation/post-grid/faq/post-grid-for-archive-page/',
247
- ),
248
-
249
250
- array(
251
- 'question'=>__('How to display HTML/Shortcode via layout editor ?', 'post-grid'),
252
- 'answer_url'=>'https://www.pickplugins.com/documentation/post-grid/faq/layout-editor-how-at-add-htmlshortcode/',
253
- ),
254
);
255
256
65
66
$tutorials = array(
67
array(
68
+ 'title'=>__('Latest Version 2.0.46 Overview', 'post-grid'),
69
+ 'url'=>'https://youtu.be/YVtsIbEb9zs',
70
+ 'keywords'=>'overview latest version',
71
),
72
73
array(
74
+ 'title'=>__('How to create post grid', 'post-grid'),
75
+ 'url'=>'https://www.youtube.com/watch?v=g5kxtJIopXs',
76
+ 'keywords'=>'',
77
),
78
array(
79
+ 'title'=>__('Custom read more text', 'post-grid'),
80
+ 'url'=>'https://www.youtube.com/watch?v=LY7IjS7SFNk',
81
+ 'keywords'=>'',
82
),
83
array(
84
+ 'title'=>__('Remove read more text', 'post-grid'),
85
+ 'url'=>'https://www.youtube.com/watch?v=ZcS2vRcTe4A',
86
),
87
array(
88
+ 'title'=>__('Excerpt word count', 'post-grid'),
89
+ 'url'=>'https://www.youtube.com/watch?v=gZ6E3UiKQqk',
90
+ 'keywords'=>'',
91
),
92
93
array(
94
+ 'title'=>__('Custom media height', 'post-grid'),
95
+ 'url'=>'https://www.youtube.com/watch?v=TupF2TpHHFA',
96
+ 'keywords'=>'',
97
),
98
array(
99
+ 'title'=>__('Item custom padding margin', 'post-grid'),
100
+ 'url'=>'https://www.youtube.com/watch?v=HRZpoib1VvI',
101
+ 'keywords'=>'',
102
),
103
array(
104
+ 'title'=>__('Grid item height', 'post-grid'),
105
+ 'url'=>'https://www.youtube.com/watch?v=ydqlgzfsboQ',
106
+ 'keywords'=>'',
107
),
108
array(
109
+ 'title'=>__('Column Width or column number', 'post-grid'),
110
+ 'url'=>'https://www.youtube.com/watch?v=ZV8hd1ij5Wo',
111
+ 'keywords'=>'',
112
),
113
array(
114
+ 'title'=>__('Post title linked', 'post-grid'),
115
+ 'url'=>'https://www.youtube.com/watch?v=oUVZB9F5d4U',
116
+ 'keywords'=>'',
117
),
118
array(
119
+ 'title'=>__('Featured image linked to post', 'post-grid'),
120
+ 'url'=>'https://www.youtube.com/watch?v=stGOJLwUF-k',
121
+ 'keywords'=>'',
122
),
123
array(
124
+ 'title'=>__('Query post by categories or terms', 'post-grid'),
125
+ 'url'=>'https://www.youtube.com/watch?v=xYzqtWRg8W4',
126
+ 'keywords'=>'',
127
),
128
array(
129
+ 'title'=>__('Query post by tags or terms', 'post-grid'),
130
+ 'url'=>'https://www.youtube.com/watch?v=RKb-B_Q72Ak',
131
+ 'keywords'=>'',
132
),
133
array(
134
+ 'title'=>__('Display search input', 'post-grid'),
135
+ 'url'=>'https://www.youtube.com/watch?v=psJR65Fmc_s',
136
+ 'keywords'=>'',
137
),
138
array(
139
+ 'title'=>__('Work with layout editor', 'post-grid'),
140
+ 'url'=>'https://www.youtube.com/watch?v=9bQc7q40jMc',
141
+ 'keywords'=>'',
142
),
143
array(
144
+ 'title'=>__('[ Pro ] Create filterable grid', 'post-grid'),
145
+ 'url'=>'https://www.youtube.com/watch?v=Zg2r7idmEm0',
146
+ 'keywords'=>'',
147
),
148
array(
149
+ 'title'=>__('[ Pro ] Filterable custom filter type data logic', 'post-grid'),
150
+ 'url'=>'https://www.youtube.com/watch?v=5Dueav6Yoyc',
151
+ 'keywords'=>'',
152
),
153
154
array(
155
+ 'title'=>__('[ Pro ] Filterable custom all text', 'post-grid'),
156
+ 'url'=>'https://www.youtube.com/watch?v=JvVkAyoXC3g',
157
+ 'keywords'=>'',
158
),
159
array(
160
+ 'title'=>__('[ Pro ] Filterable default active filter', 'post-grid'),
161
+ 'url'=>'https://www.youtube.com/watch?v=h2rbyZNhMhU',
162
+ 'keywords'=>'',
163
),
164
165
array(
166
+ 'title'=>__('[ Pro ] Filterable custom filter', 'post-grid'),
167
+ 'url'=>'https://www.youtube.com/watch?v=e8phxNKIRsU',
168
+ 'keywords'=>'',
169
),
170
171
array(
172
+ 'title'=>__('[ Pro ] Filterable dropdown single filter', 'post-grid'),
173
+ 'url'=>'https://www.youtube.com/watch?v=ZHY8qf-z3H0',
174
+ 'keywords'=>'',
175
),
176
177
array(
178
+ 'title'=>__('[ Pro ] Filterable display sort filter', 'post-grid'),
179
+ 'url'=>'https://www.youtube.com/watch?v=21TYNsp2OPI',
180
+ 'keywords'=>'',
181
),
182
183
array(
184
+ 'title'=>__('[ Pro ] Filterable multi filter', 'post-grid'),
185
+ 'url'=>'https://www.youtube.com/watch?v=uRcfd_R9YCM',
186
+ 'keywords'=>'',
187
),
188
189
190
191
array(
192
+ 'title'=>__('[ Pro ] Post grid on archive tags', 'post-grid'),
193
+ 'url'=>'https://youtu.be/lNyAjva_UXo',
194
+ 'keywords'=>'',
195
),
196
197
198
199
200
array(
201
+ 'title'=>__('[ Pro ] Query post by meta field', 'post-grid'),
202
+ 'url'=>'https://www.youtube.com/watch?v=0AIDNJvZGR0',
203
+ 'keywords'=>'',
204
),
205
206
207
array(
208
+ 'title'=>__('[ Pro ] Multi skin', 'post-grid'),
209
+ 'url'=>'https://www.youtube.com/watch?v=YzUs_P3cFCo',
210
+ 'keywords'=>'',
211
),
212
array(
213
+ 'title'=>__('[ Pro ] Sticky post query', 'post-grid'),
214
+ 'url'=>'https://www.youtube.com/watch?v=nVIOUbVjML4',
215
+ 'keywords'=>'',
216
),
217
array(
218
+ 'title'=>__('[ Pro ] Masonry layout', 'post-grid'),
219
+ 'url'=>'https://www.youtube.com/watch?v=qYjbv2euNpE',
220
+ 'keywords'=>'',
221
),
222
array(
223
+ 'title'=>__('[ Pro ] Post query by author', 'post-grid'),
224
+ 'url'=>'https://www.youtube.com/watch?v=KtoGa8NB3ig',
225
+ 'keywords'=>'',
226
),
227
array(
228
+ 'title'=>__('[ Pro ] Create glossary grid', 'post-grid'),
229
+ 'url'=>'https://www.youtube.com/watch?v=MKL4EZ-WYTs',
230
+ 'keywords'=>'',
231
),
232
array(
233
+ 'title'=>__('[ Pro ] Post carousel slider', 'post-grid'),
234
+ 'url'=>'https://www.youtube.com/watch?v=A0bZ_luBtQQ',
235
+ 'keywords'=>'',
236
),
237
238
array(
239
+ 'title'=>__('[ Pro ] Grid layout type', 'post-grid'),
240
+ 'url'=>'https://www.youtube.com/watch?v=58piQVkDZN4',
241
+ 'keywords'=>'',
242
),
243
array(
244
+ 'title'=>__('[ Pro ] Thumbnail youtube', 'post-grid'),
245
+ 'url'=>'https://www.youtube.com/watch?v=Zm5vD15yvNM',
246
+ 'keywords'=>'',
247
+ ),
248
+ array(
249
+ 'title'=>__('How to Create a Post Grid?', 'post-grid'),
250
+ 'url'=>'https://www.pickplugins.com/documentation/post-grid/faq/how-to-create-a-post-grid/',
251
+ ),
252
+ array(
253
+ 'title'=>__('How to upgrade to premium?', 'post-grid'),
254
+ 'url'=>'https://www.pickplugins.com/documentation/post-grid/upgrade-to-premium/',
255
),
256
257
+ array(
258
+ 'title'=>__('Post grid on archive page?', 'post-grid'),
259
+ 'url'=>'https://www.pickplugins.com/documentation/post-grid/faq/post-grid-for-archive-page/',
260
+ ),
261
+
262
+
263
+ array(
264
+ 'title'=>__('How to display HTML/Shortcode via layout editor ?', 'post-grid'),
265
+ 'url'=>'https://www.pickplugins.com/documentation/post-grid/faq/layout-editor-how-at-add-htmlshortcode/',
266
+ ),
267
268
);
269
277
278
public function faq(){
279
$faq = array(
280
281
);
282
283
includes/functions-layout-hook.php CHANGED
@@ -2,8 +2,6 @@
2
if ( ! defined('ABSPATH')) exit; // if direct access
3
4
add_action('post_grid_layout_element_option_custom_text','post_grid_layout_element_option_custom_text');
5
-
6
-
7
function post_grid_layout_element_option_custom_text($parameters){
8
9
$settings_tabs_field = new settings_tabs_field();
2
if ( ! defined('ABSPATH')) exit; // if direct access
3
4
add_action('post_grid_layout_element_option_custom_text','post_grid_layout_element_option_custom_text');
5
function post_grid_layout_element_option_custom_text($parameters){
6
7
$settings_tabs_field = new settings_tabs_field();
includes/functions-single.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
if ( ! defined('ABSPATH')) exit; // if direct access
3
4
- //add_action('the_content','post_grid_single_post');
5
6
function post_grid_single_post($content){
7
1
<?php
2
if ( ! defined('ABSPATH')) exit; // if direct access
3
4
+ add_action('the_content','post_grid_single_post');
5
6
function post_grid_single_post($content){
7
includes/functions/post-grid-layout-elements.php CHANGED
@@ -416,23 +416,28 @@ function post_grid_layout_element_excerpt($args){
416
if(empty($post_id)) return;
417
418
$layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
419
- //$the_post = get_post($post_id);
420
421
- //$post_excerpt = $the_post->post_excerpt;
422
- $post_excerpt = get_the_excerpt($post_id);
423
424
425
$post_link = get_permalink($post_id);
426
427
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
428
-
429
$custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
430
- $char_limit = isset($element['char_limit']) ? (int) $element['char_limit'] : 0;
431
- $read_more_text = isset($element['read_more_text']) ? $element['read_more_text'] : __('Read more', 'post-grid');
432
433
434
if($char_limit > 0){
435
- $post_excerpt = wp_trim_words($post_excerpt, $char_limit, '');
436
}
437
438
@@ -534,7 +539,7 @@ function post_grid_layout_element_excerpt_read_more($args){
534
535
$custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
536
$char_limit = isset($element['char_limit']) ? (int) $element['char_limit'] : 0;
537
- $read_more_text = isset($element['read_more_text']) ? $element['read_more_text'] : __('Read more','post-grid');
538
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
539
540
@@ -791,16 +796,18 @@ function post_grid_layout_element_css_media($args){
791
$css = isset($element['css']) ? $element['css'] : '';
792
$css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
793
794
?>
795
<style type="text/css">
796
.layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
797
- overflow: hidden;
798
<?php if(!empty($margin)): ?>
799
margin: <?php echo $margin; ?>;
800
<?php endif; ?>
801
<?php if(!empty($padding)): ?>
802
padding: <?php echo $padding; ?>;
803
<?php endif; ?>
804
<?php if(!empty($css)): ?>
805
<?php echo $css; ?>
806
<?php endif; ?>
@@ -1086,7 +1093,7 @@ function post_grid_layout_element_post_date($args){
1086
$link_to = isset($element['link_to']) ? $element['link_to'] : 'post_link';
1087
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
1088
$date_format = isset($element['date_format']) ? $element['date_format'] : 'd-m-Y';
1089
- $wrapper_html = isset($element['wrapper_html']) ? $element['wrapper_html'] : '%s';
1090
1091
1092
$post_link = get_permalink($post_id);
416
if(empty($post_id)) return;
417
418
$layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
419
+ $the_post = get_post($post_id);
420
+
421
+
422
+ $post_content = isset($the_post->post_content) ? $the_post->post_content : '';
423
+
424
+ $post_content = strip_shortcodes( $post_content );
425
+ $post_content = excerpt_remove_blocks( $post_content );
426
427
+
428
+ //$post_excerpt = get_the_excerpt($post_id);
429
430
431
$post_link = get_permalink($post_id);
432
433
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
434
$custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
435
+ $char_limit = !empty($element['char_limit']) ? (int) $element['char_limit'] : 50;
436
+ $read_more_text = isset($element['read_more_text']) ? $element['read_more_text'] : '';
437
438
439
if($char_limit > 0){
440
+ $post_excerpt = wp_trim_words($post_content, $char_limit, '');
441
}
442
443
539
540
$custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
541
$char_limit = isset($element['char_limit']) ? (int) $element['char_limit'] : 0;
542
+ $read_more_text = isset($element['read_more_text']) ? $element['read_more_text'] : '';
543
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
544
545
796
$css = isset($element['css']) ? $element['css'] : '';
797
$css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
798
799
+ //var_dump($css);
800
+
801
?>
802
<style type="text/css">
803
.layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
804
<?php if(!empty($margin)): ?>
805
margin: <?php echo $margin; ?>;
806
<?php endif; ?>
807
<?php if(!empty($padding)): ?>
808
padding: <?php echo $padding; ?>;
809
<?php endif; ?>
810
+ overflow: hidden;
811
<?php if(!empty($css)): ?>
812
<?php echo $css; ?>
813
<?php endif; ?>
1093
$link_to = isset($element['link_to']) ? $element['link_to'] : 'post_link';
1094
$link_target = isset($element['link_target']) ? $element['link_target'] : '';
1095
$date_format = isset($element['date_format']) ? $element['date_format'] : 'd-m-Y';
1096
+ $wrapper_html = !empty($element['wrapper_html']) ? $element['wrapper_html'] : '%s';
1097
1098
1099
$post_link = get_permalink($post_id);
includes/layout-elements/3rd-party.php ADDED
@@ -0,0 +1,77 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
5
+
6
+
7
+ if ( is_plugin_active( 'yet-another-stars-rating/yet-another-stars-rating.php' ) ) {
8
+
9
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/yet-another-stars-rating/layout-elements.php');
10
+ }
11
+
12
+ if ( is_plugin_active( 'rating-widget/rating-widget.php' ) ) {
13
+
14
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/rating-widget/layout-elements.php');
15
+ }
16
+
17
+
18
+ if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) ) {
19
+
20
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/yith-woocommerce-wishlist/layout-elements.php');
21
+ }
22
+
23
+
24
+
25
+ if ( is_plugin_active( 'kk-star-ratings/index.php' ) ) {
26
+
27
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/kk-star-ratings/layout-elements.php');
28
+ }
29
+
30
+
31
+
32
+
33
+
34
+ if ( is_plugin_active( 'wp-postratings/wp-postratings.php' ) ) {
35
+
36
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/wp-postratings/layout-elements.php');
37
+ }
38
+
39
+ if ( is_plugin_active( 'multi-rating/multi-rating.php' ) ) {
40
+
41
+ require_once( post_grid_plugin_dir . 'includes/layout-elements/multi-rating/layout-elements.php');
42
+ }
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
includes/layout-elements/kk-star-ratings/layout-elements.php ADDED
@@ -0,0 +1,249 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+
5
+ add_filter('post_grid_layout_elements','post_grid_pro_kk_star_ratings_layout_elements');
6
+
7
+ function post_grid_pro_kk_star_ratings_layout_elements($elements_group){
8
+
9
+ $elements_group['star_rating']['items']['kk_star_ratings'] = array('name' =>__('kk Star Ratings','post-grid'));
10
+
11
+ return $elements_group;
12
+ }
13
+
14
+
15
+ add_action('post_grid_layout_element_option_kk_star_ratings','post_grid_layout_element_option_kk_star_ratings');
16
+ function post_grid_layout_element_option_kk_star_ratings($parameters){
17
+
18
+ $settings_tabs_field = new settings_tabs_field();
19
+
20
+ $input_name = isset($parameters['input_name']) ? $parameters['input_name'] : '{input_name}';
21
+ $element_data = isset($parameters['element_data']) ? $parameters['element_data'] : array();
22
+ $element_index = isset($parameters['index']) ? $parameters['index'] : '';
23
+
24
+ $size = isset($element_data['size']) ? $element_data['size'] : '';
25
+
26
+ $color = isset($element_data['color']) ? $element_data['color'] : '';
27
+ $font_size = isset($element_data['font_size']) ? $element_data['font_size'] : '';
28
+ $margin = isset($element_data['margin']) ? $element_data['margin'] : '';
29
+ $text_align = isset($element_data['text_align']) ? $element_data['text_align'] : '';
30
+
31
+ $css = isset($element_data['css']) ? $element_data['css'] : '';
32
+ $css_hover = isset($element_data['css_hover']) ? $element_data['css_hover'] : '';
33
+
34
+
35
+
36
+ ?>
37
+ <div class="item">
38
+ <div class="element-title header ">
39
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><i class="fas fa-times"></i></span>
40
+ <span class="sort"><i class="fas fa-sort"></i></span>
41
+
42
+ <span class="expand"><?php echo __('kk Star Ratings','post-grid'); ?></span>
43
+ </div>
44
+ <div class="element-options options">
45
+
46
+ <?php
47
+
48
+ $args = array(
49
+ 'id' => 'size',
50
+ 'css_id' => $element_index.'_kk_star_ratings',
51
+ 'parent' => $input_name.'[kk_star_ratings]',
52
+ 'title' => __('size','post-grid'),
53
+ 'details' => __('Icon size, number only, ex: 20','post-grid'),
54
+ 'type' => 'text',
55
+ 'value' => $size,
56
+ 'default' => '20',
57
+ 'placeholder' => '20',
58
+ );
59
+
60
+ $settings_tabs_field->generate_field($args);
61
+
62
+ $args = array(
63
+ 'id' => 'color',
64
+ 'css_id' => $element_index.'_kk_star_ratings',
65
+ 'parent' => $input_name.'[kk_star_ratings]',
66
+ 'title' => __('Color','post-grid'),
67
+ 'details' => __('Title text color.','post-grid'),
68
+ 'type' => 'colorpicker',
69
+ 'value' => $color,
70
+ 'default' => '',
71
+ );
72
+
73
+ $settings_tabs_field->generate_field($args);
74
+
75
+ $args = array(
76
+ 'id' => 'font_size',
77
+ 'css_id' => $element_index.'_font_size',
78
+ 'parent' => $input_name.'[kk_star_ratings]',
79
+ 'title' => __('Font size','post-grid'),
80
+ 'details' => __('Set font size.','post-grid'),
81
+ 'type' => 'text',
82
+ 'value' => $font_size,
83
+ 'default' => '',
84
+ 'placeholder' => '14px',
85
+ );
86
+
87
+ $settings_tabs_field->generate_field($args);
88
+
89
+
90
+
91
+ $args = array(
92
+ 'id' => 'margin',
93
+ 'css_id' => $element_index.'_margin',
94
+ 'parent' => $input_name.'[kk_star_ratings]',
95
+ 'title' => __('Margin','post-grid'),
96
+ 'details' => __('Set margin.','post-grid'),
97
+ 'type' => 'text',
98
+ 'value' => $margin,
99
+ 'default' => '',
100
+ 'placeholder' => '5px 0',
101
+ );
102
+
103
+ $settings_tabs_field->generate_field($args);
104
+
105
+
106
+ $args = array(
107
+ 'id' => 'text_align',
108
+ 'css_id' => $element_index.'_text_align',
109
+ 'parent' => $input_name.'[kk_star_ratings]',
110
+ 'title' => __('Text align','post-grid'),
111
+ 'details' => __('Choose text align.','post-grid'),
112
+ 'type' => 'select',
113
+ 'value' => $text_align,
114
+ 'default' => 'left',
115
+ 'args' => array('left'=> __('Left', 'post-grid'),'right'=> __('Right', 'post-grid'),'center'=> __('Center', 'post-grid') ),
116
+ );
117
+
118
+ $settings_tabs_field->generate_field($args);
119
+
120
+
121
+ $args = array(
122
+ 'id' => 'css',
123
+ 'css_id' => $element_index.'_css',
124
+ 'parent' => $input_name.'[kk_star_ratings]',
125
+ 'title' => __('Custom CSS','post-grid'),
126
+ 'details' => __('Set csutom CSS.','post-grid'),
127
+ 'type' => 'textarea',
128
+ 'value' => $css,
129
+ 'default' => '',
130
+ 'placeholder' => '',
131
+ );
132
+
133
+ $settings_tabs_field->generate_field($args);
134
+
135
+ $args = array(
136
+ 'id' => 'css_hover',
137
+ 'css_id' => $element_index.'_css_hover',
138
+ 'parent' => $input_name.'[kk_star_ratings]',
139
+ 'title' => __('Hover CSS','post-grid'),
140
+ 'details' => __('Set hover custom CSS.','post-grid'),
141
+ 'type' => 'textarea',
142
+ 'value' => $css_hover,
143
+ 'default' => '',
144
+ 'placeholder' => '',
145
+ );
146
+
147
+ $settings_tabs_field->generate_field($args);
148
+
149
+
150
+ ob_start();
151
+ ?>
152
+ <textarea readonly type="text" onclick="this.select();">.element_<?php echo $element_index?>{}</textarea>
153
+ <?php
154
+
155
+ $html = ob_get_clean();
156
+
157
+ $args = array(
158
+ 'id' => 'use_css',
159
+ 'title' => __('Use of CSS','post-grid'),
160
+ 'details' => __('Use following class selector to add custom CSS for this element.','post-grid'),
161
+ 'type' => 'custom_html',
162
+ 'html' => $html,
163
+
164
+ );
165
+
166
+ $settings_tabs_field->generate_field($args);
167
+
168
+ ?>
169
+
170
+ </div>
171
+ </div>
172
+ <?php
173
+
174
+ }
175
+
176
+
177
+
178
+ add_action('post_grid_layout_element_kk_star_ratings', 'post_grid_layout_element_kk_star_ratings');
179
+ function post_grid_layout_element_kk_star_ratings($args){
180
+
181
+ $element = isset($args['element']) ? $args['element'] : array();
182
+ $elementIndex = isset($args['index']) ? $args['index'] : '';
183
+ $post_id = isset($args['post_id']) ? $args['post_id'] : '';
184
+
185
+ if(empty($post_id)) return;
186
+
187
+ $title = get_the_title($post_id);
188
+
189
+ $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
190
+ $size = isset($element['size']) ? $element['size'] : '20';
191
+
192
+
193
+ // if(!empty($acf_value)):
194
+
195
+ ?>
196
+ <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> kk_star_ratings ">
197
+ <?php echo do_shortcode("[kkratings size=$size id=$post_id]"); ?>
198
+ </div>
199
+ <?php
200
+ // endif;
201
+
202
+ }
203
+
204
+
205
+
206
+ add_action('post_grid_layout_element_css_kk_star_ratings', 'post_grid_layout_element_css_kk_star_ratings', 10);
207
+ function post_grid_layout_element_css_kk_star_ratings($args){
208
+
209
+
210
+ $index = isset($args['index']) ? $args['index'] : '';
211
+ $element = isset($args['element']) ? $args['element'] : array();
212
+ $layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
213
+
214
+ $color = isset($element['color']) ? $element['color'] : '';
215
+ $font_size = isset($element['font_size']) ? $element['font_size'] : '';
216
+ $margin = isset($element['margin']) ? $element['margin'] : '';
217
+ $text_align = isset($element['text_align']) ? $element['text_align'] : 'left';
218
+
219
+ $css = isset($element['css']) ? $element['css'] : '';
220
+ $css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
221
+
222
+ ?>
223
+ <style type="text/css">
224
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
225
+ <?php if(!empty($color)): ?>
226
+ color: <?php echo $color; ?>;
227
+ <?php endif; ?>
228
+ <?php if(!empty($font_size)): ?>
229
+ font-size: <?php echo $font_size; ?>;
230
+ <?php endif; ?>
231
+
232
+ <?php if(!empty($margin)): ?>
233
+ margin: <?php echo $margin; ?>;
234
+ <?php endif; ?>
235
+ <?php if(!empty($text_align)): ?>
236
+ text-align: <?php echo $text_align; ?>;
237
+ <?php endif; ?>
238
+ <?php if(!empty($css)): ?>
239
+ <?php echo $css; ?>
240
+ <?php endif; ?>
241
+ }
242
+ <?php if(!empty($css_hover)): ?>
243
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>:hover{
244
+ <?php echo $css_hover; ?>
245
+ }
246
+ <?php endif; ?>
247
+ </style>
248
+ <?php
249
+ }
includes/layout-elements/multi-rating/layout-elements.php ADDED
@@ -0,0 +1,277 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+
5
+ add_filter('post_grid_layout_elements','post_grid_pro_multi_rating_layout_elements');
6
+
7
+ function post_grid_pro_multi_rating_layout_elements($elements_group){
8
+
9
+ $elements_group['star_rating']['items']['multi_rating'] = array('name' =>__('Multi Rating','post-grid'));
10
+
11
+ return $elements_group;
12
+ }
13
+
14
+
15
+ add_action('post_grid_layout_element_option_multi_rating','post_grid_layout_element_option_multi_rating');
16
+ function post_grid_layout_element_option_multi_rating($parameters){
17
+
18
+ $settings_tabs_field = new settings_tabs_field();
19
+
20
+ $input_name = isset($parameters['input_name']) ? $parameters['input_name'] : '{input_name}';
21
+ $element_data = isset($parameters['element_data']) ? $parameters['element_data'] : array();
22
+ $element_index = isset($parameters['index']) ? $parameters['index'] : '';
23
+
24
+ $display_item = isset($element_data['display_item']) ? $element_data['display_item'] : '';
25
+ $no_rating_results_text = isset($element_data['no_rating_results_text']) ? $element_data['no_rating_results_text'] : '';
26
+
27
+ $color = isset($element_data['color']) ? $element_data['color'] : '';
28
+ $font_size = isset($element_data['font_size']) ? $element_data['font_size'] : '';
29
+ $margin = isset($element_data['margin']) ? $element_data['margin'] : '';
30
+ $text_align = isset($element_data['text_align']) ? $element_data['text_align'] : '';
31
+
32
+ $css = isset($element_data['css']) ? $element_data['css'] : '';
33
+ $css_hover = isset($element_data['css_hover']) ? $element_data['css_hover'] : '';
34
+
35
+
36
+
37
+ ?>
38
+ <div class="item">
39
+ <div class="element-title header ">
40
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><i class="fas fa-times"></i></span>
41
+ <span class="sort"><i class="fas fa-sort"></i></span>
42
+
43
+ <span class="expand"><?php echo __('Multi Rating','post-grid'); ?></span>
44
+ </div>
45
+ <div class="element-options options">
46
+
47
+ <?php
48
+
49
+ $args = array(
50
+ 'id' => 'display_item',
51
+ 'css_id' => $element_index.'_text_align',
52
+ 'parent' => $input_name.'[multi_rating]',
53
+ 'title' => __('Display item','post-grid'),
54
+ 'details' => __('Choose display items.','post-grid'),
55
+ 'type' => 'select',
56
+ 'value' => $display_item,
57
+ 'default' => 'result',
58
+ 'args' => array('result'=> __('Result', 'post-grid'),'rating_button'=> __('Rating button', 'post-grid'),'both'=> __('Both', 'post-grid') ),
59
+ );
60
+
61
+ $settings_tabs_field->generate_field($args);
62
+
63
+ $args = array(
64
+ 'id' => 'no_rating_results_text',
65
+ 'css_id' => $element_index.'_multi_rating',
66
+ 'parent' => $input_name.'[multi_rating]',
67
+ 'title' => __('No rating text','post-grid'),
68
+ 'details' => __('Custom text.','post-grid'),
69
+ 'type' => 'text',
70
+ 'value' => $no_rating_results_text,
71
+ 'default' => '',
72
+ );
73
+
74
+ $settings_tabs_field->generate_field($args);
75
+
76
+ $args = array(
77
+ 'id' => 'color',
78
+ 'css_id' => $element_index.'_multi_rating',
79
+ 'parent' => $input_name.'[multi_rating]',
80
+ 'title' => __('Color','post-grid'),
81
+ 'details' => __('Title text color.','post-grid'),
82
+ 'type' => 'colorpicker',
83
+ 'value' => $color,
84
+ 'default' => '',
85
+ );
86
+
87
+ $settings_tabs_field->generate_field($args);
88
+
89
+ $args = array(
90
+ 'id' => 'font_size',
91
+ 'css_id' => $element_index.'_font_size',
92
+ 'parent' => $input_name.'[multi_rating]',
93
+ 'title' => __('Font size','post-grid'),
94
+ 'details' => __('Set font size.','post-grid'),
95
+ 'type' => 'text',
96
+ 'value' => $font_size,
97
+ 'default' => '',
98
+ 'placeholder' => '14px',
99
+ );
100
+
101
+ $settings_tabs_field->generate_field($args);
102
+
103
+
104
+
105
+ $args = array(
106
+ 'id' => 'margin',
107
+ 'css_id' => $element_index.'_margin',
108
+ 'parent' => $input_name.'[multi_rating]',
109
+ 'title' => __('Margin','post-grid'),
110
+ 'details' => __('Set margin.','post-grid'),
111
+ 'type' => 'text',
112
+ 'value' => $margin,
113
+ 'default' => '',
114
+ 'placeholder' => '5px 0',
115
+ );
116
+
117
+ $settings_tabs_field->generate_field($args);
118
+
119
+
120
+ $args = array(
121
+ 'id' => 'text_align',
122
+ 'css_id' => $element_index.'_text_align',
123
+ 'parent' => $input_name.'[multi_rating]',
124
+ 'title' => __('Text align','post-grid'),
125
+ 'details' => __('Choose text align.','post-grid'),
126
+ 'type' => 'select',
127
+ 'value' => $text_align,
128
+ 'default' => 'left',
129
+ 'args' => array('left'=> __('Left', 'post-grid'),'right'=> __('Right', 'post-grid'),'center'=> __('Center', 'post-grid') ),
130
+ );
131
+
132
+ $settings_tabs_field->generate_field($args);
133
+
134
+
135
+ $args = array(
136
+ 'id' => 'css',
137
+ 'css_id' => $element_index.'_css',
138
+ 'parent' => $input_name.'[multi_rating]',
139
+ 'title' => __('Custom CSS','post-grid'),
140
+ 'details' => __('Set csutom CSS.','post-grid'),
141
+ 'type' => 'textarea',
142
+ 'value' => $css,
143
+ 'default' => '',
144
+ 'placeholder' => '',
145
+ );
146
+
147
+ $settings_tabs_field->generate_field($args);
148
+
149
+ $args = array(
150
+ 'id' => 'css_hover',
151
+ 'css_id' => $element_index.'_css_hover',
152
+ 'parent' => $input_name.'[multi_rating]',
153
+ 'title' => __('Hover CSS','post-grid'),
154
+ 'details' => __('Set hover custom CSS.','post-grid'),
155
+ 'type' => 'textarea',
156
+ 'value' => $css_hover,
157
+ 'default' => '',
158
+ 'placeholder' => '',
159
+ );
160
+
161
+ $settings_tabs_field->generate_field($args);
162
+
163
+
164
+ ob_start();
165
+ ?>
166
+ <textarea readonly type="text" onclick="this.select();">.element_<?php echo $element_index?>{}</textarea>
167
+ <?php
168
+
169
+ $html = ob_get_clean();
170
+
171
+ $args = array(
172
+ 'id' => 'use_css',
173
+ 'title' => __('Use of CSS','post-grid'),
174
+ 'details' => __('Use following class selector to add custom CSS for this element.','post-grid'),
175
+ 'type' => 'custom_html',
176
+ 'html' => $html,
177
+
178
+ );
179
+
180
+ $settings_tabs_field->generate_field($args);
181
+
182
+ ?>
183
+
184
+ </div>
185
+ </div>
186
+ <?php
187
+
188
+ }
189
+
190
+
191
+
192
+ add_action('post_grid_layout_element_multi_rating', 'post_grid_layout_element_multi_rating');
193
+ function post_grid_layout_element_multi_rating($args){
194
+
195
+ $element = isset($args['element']) ? $args['element'] : array();
196
+ $elementIndex = isset($args['index']) ? $args['index'] : '';
197
+ $post_id = isset($args['post_id']) ? $args['post_id'] : '';
198
+
199
+ if(empty($post_id)) return;
200
+
201
+ $title = get_the_title($post_id);
202
+
203
+ $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
204
+ $display_item = isset($element['display_item']) ? $element['display_item'] : 'result';
205
+ $no_rating_results_text = isset($element['no_rating_results_text']) ? $element['no_rating_results_text'] : '';
206
+
207
+
208
+ // if(!empty($acf_value)):
209
+
210
+ ?>
211
+ <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> multi_rating ">
212
+ <?php
213
+ if($display_item =='result'){
214
+ echo do_shortcode("[mr_rating_result post_id='".$post_id."' no_rating_results_text='".$no_rating_results_text."']");
215
+
216
+ }elseif ($display_item =='rating_button'){
217
+ echo do_shortcode("[mr_rating_form post_id=$post_id]");
218
+
219
+ }elseif ($display_item =='both'){
220
+ echo do_shortcode("[mr_rating_result post_id='".$post_id."' no_rating_results_text='".$no_rating_results_text."']");
221
+ echo do_shortcode("[mr_rating_form post_id=$post_id]");
222
+ }
223
+
224
+ ?>
225
+
226
+ </div>
227
+ <?php
228
+ // endif;
229
+
230
+ }
231
+
232
+
233
+
234
+ add_action('post_grid_layout_element_css_multi_rating', 'post_grid_layout_element_css_multi_rating', 10);
235
+ function post_grid_layout_element_css_multi_rating($args){
236
+
237
+
238
+ $index = isset($args['index']) ? $args['index'] : '';
239
+ $element = isset($args['element']) ? $args['element'] : array();
240
+ $layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
241
+
242
+ $color = isset($element['color']) ? $element['color'] : '';
243
+ $font_size = isset($element['font_size']) ? $element['font_size'] : '';
244
+ $margin = isset($element['margin']) ? $element['margin'] : '';
245
+ $text_align = isset($element['text_align']) ? $element['text_align'] : 'left';
246
+
247
+ $css = isset($element['css']) ? $element['css'] : '';
248
+ $css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
249
+
250
+ ?>
251
+ <style type="text/css">
252
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
253
+ <?php if(!empty($color)): ?>
254
+ color: <?php echo $color; ?>;
255
+ <?php endif; ?>
256
+ <?php if(!empty($font_size)): ?>
257
+ font-size: <?php echo $font_size; ?>;
258
+ <?php endif; ?>
259
+
260
+ <?php if(!empty($margin)): ?>
261
+ margin: <?php echo $margin; ?>;
262
+ <?php endif; ?>
263
+ <?php if(!empty($text_align)): ?>
264
+ text-align: <?php echo $text_align; ?>;
265
+ <?php endif; ?>
266
+ <?php if(!empty($css)): ?>
267
+ <?php echo $css; ?>
268
+ <?php endif; ?>
269
+ }
270
+ <?php if(!empty($css_hover)): ?>
271
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>:hover{
272
+ <?php echo $css_hover; ?>
273
+ }
274
+ <?php endif; ?>
275
+ </style>
276
+ <?php
277
+ }
includes/layout-elements/rate-my-post/layout-elements.php ADDED
@@ -0,0 +1,264 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+
5
+ add_filter('post_grid_layout_elements','post_grid_pro_rate_my_post_layout_elements');
6
+
7
+ function post_grid_pro_rate_my_post_layout_elements($elements_group){
8
+
9
+ $elements_group['star_rating']['items']['rate_my_post'] = array('name' =>__('Rate my Post','post-grid'));
10
+
11
+ return $elements_group;
12
+ }
13
+
14
+
15
+ add_action('post_grid_layout_element_option_rate_my_post','post_grid_layout_element_option_rate_my_post');
16
+ function post_grid_layout_element_option_rate_my_post($parameters){
17
+
18
+ $settings_tabs_field = new settings_tabs_field();
19
+
20
+ $input_name = isset($parameters['input_name']) ? $parameters['input_name'] : '{input_name}';
21
+ $element_data = isset($parameters['element_data']) ? $parameters['element_data'] : array();
22
+ $element_index = isset($parameters['index']) ? $parameters['index'] : '';
23
+
24
+ $display_item = isset($element_data['display_item']) ? $element_data['display_item'] : '';
25
+
26
+ $color = isset($element_data['color']) ? $element_data['color'] : '';
27
+ $font_size = isset($element_data['font_size']) ? $element_data['font_size'] : '';
28
+ $margin = isset($element_data['margin']) ? $element_data['margin'] : '';
29
+ $text_align = isset($element_data['text_align']) ? $element_data['text_align'] : '';
30
+
31
+ $css = isset($element_data['css']) ? $element_data['css'] : '';
32
+ $css_hover = isset($element_data['css_hover']) ? $element_data['css_hover'] : '';
33
+
34
+
35
+
36
+ ?>
37
+ <div class="item">
38
+ <div class="element-title header ">
39
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><i class="fas fa-times"></i></span>
40
+ <span class="sort"><i class="fas fa-sort"></i></span>
41
+
42
+ <span class="expand"><?php echo __('Rate my Post','post-grid'); ?></span>
43
+ </div>
44
+ <div class="element-options options">
45
+
46
+ <?php
47
+
48
+ $args = array(
49
+ 'id' => 'display_item',
50
+ 'css_id' => $element_index.'_text_align',
51
+ 'parent' => $input_name.'[rate_my_post]',
52
+ 'title' => __('Display','post-grid'),
53
+ 'details' => __('Choose display.','post-grid'),
54
+ 'type' => 'select',
55
+ 'value' => $display_item,
56
+ 'default' => 'result',
57
+ 'args' => array('result'=> __('Result', 'post-grid'), 'rating_widget'=> __('Rating widget', 'post-grid'), 'both'=> __('Both', 'post-grid') ),
58
+ );
59
+
60
+ $settings_tabs_field->generate_field($args);
61
+
62
+
63
+
64
+ $args = array(
65
+ 'id' => 'color',
66
+ 'css_id' => $element_index.'_rate_my_post',
67
+ 'parent' => $input_name.'[rate_my_post]',
68
+ 'title' => __('Color','post-grid'),
69
+ 'details' => __('Title text color.','post-grid'),
70
+ 'type' => 'colorpicker',
71
+ 'value' => $color,
72
+ 'default' => '',
73
+ );
74
+
75
+ $settings_tabs_field->generate_field($args);
76
+
77
+ $args = array(
78
+ 'id' => 'font_size',
79
+ 'css_id' => $element_index.'_font_size',
80
+ 'parent' => $input_name.'[rate_my_post]',
81
+ 'title' => __('Font size','post-grid'),
82
+ 'details' => __('Set font size.','post-grid'),
83
+ 'type' => 'text',
84
+ 'value' => $font_size,
85
+ 'default' => '',
86
+ 'placeholder' => '14px',
87
+ );
88
+
89
+ $settings_tabs_field->generate_field($args);
90
+
91
+
92
+
93
+ $args = array(
94
+ 'id' => 'margin',
95
+ 'css_id' => $element_index.'_margin',
96
+ 'parent' => $input_name.'[rate_my_post]',
97
+ 'title' => __('Margin','post-grid'),
98
+ 'details' => __('Set margin.','post-grid'),
99
+ 'type' => 'text',
100
+ 'value' => $margin,
101
+ 'default' => '',
102
+ 'placeholder' => '5px 0',
103
+ );
104
+
105
+ $settings_tabs_field->generate_field($args);
106
+
107
+
108
+ $args = array(
109
+ 'id' => 'text_align',
110
+ 'css_id' => $element_index.'_text_align',
111
+ 'parent' => $input_name.'[rate_my_post]',
112
+ 'title' => __('Text align','post-grid'),
113
+ 'details' => __('Choose text align.','post-grid'),
114
+ 'type' => 'select',
115
+ 'value' => $text_align,
116
+ 'default' => 'left',
117
+ 'args' => array('left'=> __('Left', 'post-grid'),'right'=> __('Right', 'post-grid'),'center'=> __('Center', 'post-grid') ),
118
+ );
119
+
120
+ $settings_tabs_field->generate_field($args);
121
+
122
+
123
+ $args = array(
124
+ 'id' => 'css',
125
+ 'css_id' => $element_index.'_css',
126
+ 'parent' => $input_name.'[rate_my_post]',
127
+ 'title' => __('Custom CSS','post-grid'),
128
+ 'details' => __('Set csutom CSS.','post-grid'),
129
+ 'type' => 'textarea',
130
+ 'value' => $css,
131
+ 'default' => '',
132
+ 'placeholder' => '',
133
+ );
134
+
135
+ $settings_tabs_field->generate_field($args);
136
+
137
+ $args = array(
138
+ 'id' => 'css_hover',
139
+ 'css_id' => $element_index.'_css_hover',
140
+ 'parent' => $input_name.'[rate_my_post]',
141
+ 'title' => __('Hover CSS','post-grid'),
142
+ 'details' => __('Set hover custom CSS.','post-grid'),
143
+ 'type' => 'textarea',
144
+ 'value' => $css_hover,
145
+ 'default' => '',
146
+ 'placeholder' => '',
147
+ );
148
+
149
+ $settings_tabs_field->generate_field($args);
150
+
151
+
152
+ ob_start();
153
+ ?>
154
+ <textarea readonly type="text" onclick="this.select();">.element_<?php echo $element_index?>{}</textarea>
155
+ <?php
156
+
157
+ $html = ob_get_clean();
158
+
159
+ $args = array(
160
+ 'id' => 'use_css',
161
+ 'title' => __('Use of CSS','post-grid'),
162
+ 'details' => __('Use following class selector to add custom CSS for this element.','post-grid'),
163
+ 'type' => 'custom_html',
164
+ 'html' => $html,
165
+
166
+ );
167
+
168
+ $settings_tabs_field->generate_field($args);
169
+
170
+ ?>
171
+
172
+ </div>
173
+ </div>
174
+ <?php
175
+
176
+ }
177
+
178
+
179
+
180
+ add_action('post_grid_layout_element_rate_my_post', 'post_grid_layout_element_rate_my_post');
181
+ function post_grid_layout_element_rate_my_post($args){
182
+
183
+ $element = isset($args['element']) ? $args['element'] : array();
184
+ $elementIndex = isset($args['index']) ? $args['index'] : '';
185
+ $post_id = isset($args['post_id']) ? $args['post_id'] : '';
186
+
187
+ if(empty($post_id)) return;
188
+
189
+ $title = get_the_title($post_id);
190
+
191
+ $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
192
+ $display_item = isset($element['display_item']) ? $element['display_item'] : 'result';
193
+
194
+
195
+ // if(!empty($acf_value)):
196
+
197
+ ?>
198
+ <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> rate_my_post ">
199
+ <?php
200
+ if($display_item == 'result'){
201
+ echo do_shortcode("[ratemypost-result id=$post_id]");
202
+
203
+ }elseif ($display_item =='rating_widget'){
204
+ echo do_shortcode("[ratemypost id=$post_id]");
205
+
206
+ }elseif ($display_item =='both'){
207
+ echo do_shortcode("[ratemypost-result id=$post_id]");
208
+ echo do_shortcode("[ratemypost id=$post_id]");
209
+ }
210
+
211
+
212
+ ?>
213
+ </div>
214
+ <?php
215
+ // endif;
216
+
217
+ }
218
+
219
+
220
+
221
+ add_action('post_grid_layout_element_css_rate_my_post', 'post_grid_layout_element_css_rate_my_post', 10);
222
+ function post_grid_layout_element_css_rate_my_post($args){
223
+
224
+
225
+ $index = isset($args['index']) ? $args['index'] : '';
226
+ $element = isset($args['element']) ? $args['element'] : array();
227
+ $layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
228
+
229
+ $color = isset($element['color']) ? $element['color'] : '';
230
+ $font_size = isset($element['font_size']) ? $element['font_size'] : '';
231
+ $margin = isset($element['margin']) ? $element['margin'] : '';
232
+ $text_align = isset($element['text_align']) ? $element['text_align'] : 'left';
233
+
234
+ $css = isset($element['css']) ? $element['css'] : '';
235
+ $css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
236
+
237
+ ?>
238
+ <style type="text/css">
239
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
240
+ <?php if(!empty($color)): ?>
241
+ color: <?php echo $color; ?>;
242
+ <?php endif; ?>
243
+ <?php if(!empty($font_size)): ?>
244
+ font-size: <?php echo $font_size; ?>;
245
+ <?php endif; ?>
246
+
247
+ <?php if(!empty($margin)): ?>
248
+ margin: <?php echo $margin; ?>;
249
+ <?php endif; ?>
250
+ <?php if(!empty($text_align)): ?>
251
+ text-align: <?php echo $text_align; ?>;
252
+ <?php endif; ?>
253
+ <?php if(!empty($css)): ?>
254
+ <?php echo $css; ?>
255
+ <?php endif; ?>
256
+ }
257
+ <?php if(!empty($css_hover)): ?>
258
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>:hover{
259
+ <?php echo $css_hover; ?>
260
+ }
261
+ <?php endif; ?>
262
+ </style>
263
+ <?php
264
+ }
includes/layout-elements/rating-widget/layout-elements.php ADDED
@@ -0,0 +1,235 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+
5
+ add_filter('post_grid_layout_elements','post_grid_pro_rating_widget_layout_elements');
6
+
7
+ function post_grid_pro_rating_widget_layout_elements($elements_group){
8
+
9
+ $elements_group['star_rating']['items']['rating_widget'] = array('name' =>__('Rating-Widget','post-grid'));
10
+
11
+ return $elements_group;
12
+ }
13
+
14
+
15
+ add_action('post_grid_layout_element_option_rating_widget','post_grid_layout_element_option_rating_widget');
16
+ function post_grid_layout_element_option_rating_widget($parameters){
17
+
18
+ $settings_tabs_field = new settings_tabs_field();
19
+
20
+ $input_name = isset($parameters['input_name']) ? $parameters['input_name'] : '{input_name}';
21
+ $element_data = isset($parameters['element_data']) ? $parameters['element_data'] : array();
22
+ $element_index = isset($parameters['index']) ? $parameters['index'] : '';
23
+
24
+
25
+ $color = isset($element_data['color']) ? $element_data['color'] : '';
26
+ $font_size = isset($element_data['font_size']) ? $element_data['font_size'] : '';
27
+ $margin = isset($element_data['margin']) ? $element_data['margin'] : '';
28
+ $text_align = isset($element_data['text_align']) ? $element_data['text_align'] : '';
29
+
30
+ $css = isset($element_data['css']) ? $element_data['css'] : '';
31
+ $css_hover = isset($element_data['css_hover']) ? $element_data['css_hover'] : '';
32
+
33
+
34
+
35
+ ?>
36
+ <div class="item">
37
+ <div class="element-title header ">
38
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><i class="fas fa-times"></i></span>
39
+ <span class="sort"><i class="fas fa-sort"></i></span>
40
+
41
+ <span class="expand"><?php echo __('Rating-Widget','post-grid'); ?></span>
42
+ </div>
43
+ <div class="element-options options">
44
+
45
+ <?php
46
+
47
+
48
+ $args = array(
49
+ 'id' => 'color',
50
+ 'css_id' => $element_index.'_rating_widget',
51
+ 'parent' => $input_name.'[rating_widget]',
52
+ 'title' => __('Color','post-grid'),
53
+ 'details' => __('Title text color.','post-grid'),
54
+ 'type' => 'colorpicker',
55
+ 'value' => $color,
56
+ 'default' => '',
57
+ );
58
+
59
+ $settings_tabs_field->generate_field($args);
60
+
61
+ $args = array(
62
+ 'id' => 'font_size',
63
+ 'css_id' => $element_index.'_font_size',
64
+ 'parent' => $input_name.'[rating_widget]',
65
+ 'title' => __('Font size','post-grid'),
66
+ 'details' => __('Set font size.','post-grid'),
67
+ 'type' => 'text',
68
+ 'value' => $font_size,
69
+ 'default' => '',
70
+ 'placeholder' => '14px',
71
+ );
72
+
73
+ $settings_tabs_field->generate_field($args);
74
+
75
+
76
+
77
+ $args = array(
78
+ 'id' => 'margin',
79
+ 'css_id' => $element_index.'_margin',
80
+ 'parent' => $input_name.'[rating_widget]',
81
+ 'title' => __('Margin','post-grid'),
82
+ 'details' => __('Set margin.','post-grid'),
83
+ 'type' => 'text',
84
+ 'value' => $margin,
85
+ 'default' => '',
86
+ 'placeholder' => '5px 0',
87
+ );
88
+
89
+ $settings_tabs_field->generate_field($args);
90
+
91
+
92
+ $args = array(
93
+ 'id' => 'text_align',
94
+ 'css_id' => $element_index.'_text_align',
95
+ 'parent' => $input_name.'[rating_widget]',
96
+ 'title' => __('Text align','post-grid'),
97
+ 'details' => __('Choose text align.','post-grid'),
98
+ 'type' => 'select',
99
+ 'value' => $text_align,
100
+ 'default' => 'left',
101
+ 'args' => array('left'=> __('Left', 'post-grid'),'right'=> __('Right', 'post-grid'),'center'=> __('Center', 'post-grid') ),
102
+ );
103
+
104
+ $settings_tabs_field->generate_field($args);
105
+
106
+
107
+ $args = array(
108
+ 'id' => 'css',
109
+ 'css_id' => $element_index.'_css',
110
+ 'parent' => $input_name.'[rating_widget]',
111
+ 'title' => __('Custom CSS','post-grid'),
112
+ 'details' => __('Set csutom CSS.','post-grid'),
113
+ 'type' => 'textarea',
114
+ 'value' => $css,
115
+ 'default' => '',
116
+ 'placeholder' => '',
117
+ );
118
+
119
+ $settings_tabs_field->generate_field($args);
120
+
121
+ $args = array(
122
+ 'id' => 'css_hover',
123
+ 'css_id' => $element_index.'_css_hover',
124
+ 'parent' => $input_name.'[rating_widget]',
125
+ 'title' => __('Hover CSS','post-grid'),
126
+ 'details' => __('Set hover custom CSS.','post-grid'),
127
+ 'type' => 'textarea',
128
+ 'value' => $css_hover,
129
+ 'default' => '',
130
+ 'placeholder' => '',
131
+ );
132
+
133
+ $settings_tabs_field->generate_field($args);
134
+
135
+
136
+ ob_start();
137
+ ?>
138
+ <textarea readonly type="text" onclick="this.select();">.element_<?php echo $element_index?>{}</textarea>
139
+ <?php
140
+
141
+ $html = ob_get_clean();
142
+
143
+ $args = array(
144
+ 'id' => 'use_css',
145
+ 'title' => __('Use of CSS','post-grid'),
146
+ 'details' => __('Use following class selector to add custom CSS for this element.','post-grid'),
147
+ 'type' => 'custom_html',
148
+ 'html' => $html,
149
+
150
+ );
151
+
152
+ $settings_tabs_field->generate_field($args);
153
+
154
+ ?>
155
+
156
+ </div>
157
+ </div>
158
+ <?php
159
+
160
+ }
161
+
162
+
163
+
164
+ add_action('post_grid_layout_element_rating_widget', 'post_grid_layout_element_rating_widget');
165
+ function post_grid_layout_element_rating_widget($args){
166
+
167
+ $element = isset($args['element']) ? $args['element'] : array();
168
+ $elementIndex = isset($args['index']) ? $args['index'] : '';
169
+ $post_id = isset($args['post_id']) ? $args['post_id'] : '';
170
+
171
+ if(empty($post_id)) return;
172
+
173
+ $title = get_the_title($post_id);
174
+
175
+ $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
176
+ $size = isset($element['size']) ? $element['size'] : 'small';
177
+
178
+
179
+ // if(!empty($acf_value)):
180
+
181
+ ?>
182
+ <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> rating_widget ">
183
+ <?php echo do_shortcode("[ratingwidget post_id=$post_id]"); ?>
184
+ </div>
185
+ <?php
186
+ // endif;
187
+
188
+ }
189
+
190
+
191
+
192
+ add_action('post_grid_layout_element_css_rating_widget', 'post_grid_layout_element_css_rating_widget', 10);
193
+ function post_grid_layout_element_css_rating_widget($args){
194
+
195
+
196
+ $index = isset($args['index']) ? $args['index'] : '';
197
+ $element = isset($args['element']) ? $args['element'] : array();
198
+ $layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
199
+
200
+ $color = isset($element['color']) ? $element['color'] : '';
201
+ $font_size = isset($element['font_size']) ? $element['font_size'] : '';
202
+ $margin = isset($element['margin']) ? $element['margin'] : '';
203
+ $text_align = isset($element['text_align']) ? $element['text_align'] : 'left';
204
+
205
+ $css = isset($element['css']) ? $element['css'] : '';
206
+ $css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
207
+
208
+ ?>
209
+ <style type="text/css">
210
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
211
+ <?php if(!empty($color)): ?>
212
+ color: <?php echo $color; ?>;
213
+ <?php endif; ?>
214
+ <?php if(!empty($font_size)): ?>
215
+ font-size: <?php echo $font_size; ?>;
216
+ <?php endif; ?>
217
+
218
+ <?php if(!empty($margin)): ?>
219
+ margin: <?php echo $margin; ?>;
220
+ <?php endif; ?>
221
+ <?php if(!empty($text_align)): ?>
222
+ text-align: <?php echo $text_align; ?>;
223
+ <?php endif; ?>
224
+ <?php if(!empty($css)): ?>
225
+ <?php echo $css; ?>
226
+ <?php endif; ?>
227
+ }
228
+ <?php if(!empty($css_hover)): ?>
229
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>:hover{
230
+ <?php echo $css_hover; ?>
231
+ }
232
+ <?php endif; ?>
233
+ </style>
234
+ <?php
235
+ }
includes/layout-elements/wp-postratings/layout-elements.php ADDED
@@ -0,0 +1,250 @@
1
+ <?php
2
+ if ( ! defined('ABSPATH')) exit; // if direct access
3
+
4
+
5
+ add_filter('post_grid_layout_elements','post_grid_pro_wp_postratings_layout_elements');
6
+
7
+ function post_grid_pro_wp_postratings_layout_elements($elements_group){
8
+
9
+ $elements_group['star_rating']['items']['wp_postratings'] = array('name' =>__('WP-PostRatings','post-grid'));
10
+
11
+ return $elements_group;
12
+ }
13
+
14
+
15
+ add_action('post_grid_layout_element_option_wp_postratings','post_grid_layout_element_option_wp_postratings');
16
+ function post_grid_layout_element_option_wp_postratings($parameters){
17
+
18
+ $settings_tabs_field = new settings_tabs_field();
19
+
20
+ $input_name = isset($parameters['input_name']) ? $parameters['input_name'] : '{input_name}';
21
+ $element_data = isset($parameters['element_data']) ? $parameters['element_data'] : array();
22
+ $element_index = isset($parameters['index']) ? $parameters['index'] : '';
23
+
24
+ $size = isset($element_data['size']) ? $element_data['size'] : '';
25
+
26
+ $color = isset($element_data['color']) ? $element_data['color'] : '';
27
+ $font_size = isset($element_data['font_size']) ? $element_data['font_size'] : '';
28
+ $margin = isset($element_data['margin']) ? $element_data['margin'] : '';
29
+ $text_align = isset($element_data['text_align']) ? $element_data['text_align'] : '';
30
+
31
+ $css = isset($element_data['css']) ? $element_data['css'] : '';
32
+ $css_hover = isset($element_data['css_hover']) ? $element_data['css_hover'] : '';
33
+
34
+
35
+
36
+ ?>
37
+ <div class="item">
38
+ <div class="element-title header ">
39
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><i class="fas fa-times"></i></span>
40
+ <span class="sort"><i class="fas fa-sort"></i></span>
41
+
42
+ <span class="expand"><?php echo __('WP-PostRatings','post-grid'); ?></span>
43
+ </div>
44
+ <div class="element-options options">
45
+
46
+ <?php
47
+
48
+ $args = array(
49
+ 'id' => 'size',
50
+ 'css_id' => $element_index.'_wp_postratings',
51
+ 'parent' => $input_name.'[wp_postratings]',
52
+ 'title' => __('size','post-grid'),
53
+ 'details' => __('Icon size, number only, ex: 20','post-grid'),
54
+ 'type' => 'text',
55
+ 'value' => $size,
56
+ 'default' => '20',
57
+ 'placeholder' => '20',
58
+ );
59
+
60
+ $settings_tabs_field->generate_field($args);
61
+
62
+ $args = array(
63
+ 'id' => 'color',
64
+ 'css_id' => $element_index.'_wp_postratings',
65
+ 'parent' => $input_name.'[wp_postratings]',
66
+ 'title' => __('Color','post-grid'),
67
+ 'details' => __('Title text color.','post-grid'),
68
+ 'type' => 'colorpicker',
69
+ 'value' => $color,
70
+ 'default' => '',
71
+ );
72
+
73
+ $settings_tabs_field->generate_field($args);
74
+
75
+ $args = array(
76
+ 'id' => 'font_size',
77
+ 'css_id' => $element_index.'_font_size',
78
+ 'parent' => $input_name.'[wp_postratings]',
79
+ 'title' => __('Font size','post-grid'),
80
+ 'details' => __('Set font size.','post-grid'),
81
+ 'type' => 'text',
82
+ 'value' => $font_size,
83
+ 'default' => '',
84
+ 'placeholder' => '14px',
85
+ );
86
+
87
+ $settings_tabs_field->generate_field($args);
88
+
89
+
90
+
91
+ $args = array(
92
+ 'id' => 'margin',
93
+ 'css_id' => $element_index.'_margin',
94
+ 'parent' => $input_name.'[wp_postratings]',
95
+ 'title' => __('Margin','post-grid'),
96
+ 'details' => __('Set margin.','post-grid'),
97
+ 'type' => 'text',
98
+ 'value' => $margin,
99
+ 'default' => '',
100
+ 'placeholder' => '5px 0',
101
+ );
102
+
103
+ $settings_tabs_field->generate_field($args);
104
+
105
+
106
+ $args = array(
107
+ 'id' => 'text_align',
108
+ 'css_id' => $element_index.'_text_align',
109
+ 'parent' => $input_name.'[wp_postratings]',
110
+ 'title' => __('Text align','post-grid'),
111
+ 'details' => __('Choose text align.','post-grid'),
112
+ 'type' => 'select',
113
+ 'value' => $text_align,
114
+ 'default' => 'left',
115
+ 'args' => array('left'=> __('Left', 'post-grid'),'right'=> __('Right', 'post-grid'),'center'=> __('Center', 'post-grid') ),
116
+ );
117
+
118
+ $settings_tabs_field->generate_field($args);
119
+
120
+
121
+ $args = array(
122
+ 'id' => 'css',
123
+ 'css_id' => $element_index.'_css',
124
+ 'parent' => $input_name.'[wp_postratings]',
125
+ 'title' => __('Custom CSS','post-grid'),
126
+ 'details' => __('Set csutom CSS.','post-grid'),
127
+ 'type' => 'textarea',
128
+ 'value' => $css,
129
+ 'default' => '',
130
+ 'placeholder' => '',
131
+ );
132
+
133
+ $settings_tabs_field->generate_field($args);
134
+
135
+ $args = array(
136
+ 'id' => 'css_hover',
137
+ 'css_id' => $element_index.'_css_hover',
138
+ 'parent' => $input_name.'[wp_postratings]',
139
+ 'title' => __('Hover CSS','post-grid'),
140
+ 'details' => __('Set hover custom CSS.','post-grid'),
141
+ 'type' => 'textarea',
142
+ 'value' => $css_hover,
143
+ 'default' => '',
144
+ 'placeholder' => '',
145
+ );
146
+
147
+ $settings_tabs_field->generate_field($args);
148
+
149
+
150
+ ob_start();
151
+ ?>
152
+ <textarea readonly type="text" onclick="this.select();">.element_<?php echo $element_index?>{}</textarea>
153
+ <?php
154
+
155
+ $html = ob_get_clean();
156
+
157
+ $args = array(
158
+ 'id' => 'use_css',
159
+ 'title' => __('Use of CSS','post-grid'),
160
+ 'details' => __('Use following class selector to add custom CSS for this element.','post-grid'),
161
+ 'type' => 'custom_html',
162
+ 'html' => $html,
163
+
164
+ );
165
+
166
+ $settings_tabs_field->generate_field($args);
167
+
168
+ ?>
169
+
170
+ </div>
171
+ </div>
172
+ <?php
173
+
174
+ }
175
+
176
+
177
+
178
+ add_action('post_grid_layout_element_wp_postratings', 'post_grid_layout_element_wp_postratings');
179
+ function post_grid_layout_element_wp_postratings($args){
180
+
181
+ $element = isset($args['element']) ? $args['element'] : array();
182
+ $elementIndex = isset($args['index']) ? $args['index'] : '';
183
+ $post_id = isset($args['post_id']) ? $args['post_id'] : '';
184
+
185
+ if(empty($post_id)) return;
186
+
187
+ $title = get_the_title($post_id);
188
+
189
+ $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
190
+ $size = isset($element['size']) ? $element['size'] : '20';
191
+
192
+
193
+
194
+ if(function_exists('the_ratings')) {
195
+ ?>
196
+ <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> wp_postratings ">
197
+ <?php the_ratings(); ?>
198
+ </div>
199
+ <?php
200
+ }
201
+
202
+
203
+ }
204
+
205
+
206
+
207
+ add_action('post_grid_layout_element_css_wp_postratings', 'post_grid_layout_element_css_wp_postratings', 10);
208
+ function post_grid_layout_element_css_wp_postratings($args){
209
+
210
+
211
+ $index = isset($args['index']) ? $args['index'] : '';
212
+ $element = isset($args['element']) ? $args['element'] : array();
213
+ $layout_id = isset($args['layout_id']) ? $args['layout_id'] : '';
214
+
215
+ $color = isset($element['color']) ? $element['color'] : '';
216
+ $font_size = isset($element['font_size']) ? $element['font_size'] : '';
217
+ $margin = isset($element['margin']) ? $element['margin'] : '';
218
+ $text_align = isset($element['text_align']) ? $element['text_align'] : 'left';
219
+
220
+ $css = isset($element['css']) ? $element['css'] : '';
221
+ $css_hover = isset($element['css_hover']) ? $element['css_hover'] : '';
222
+
223
+ ?>
224
+ <style type="text/css">
225
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>{
226
+ <?php if(!empty($color)): ?>
227
+ color: <?php echo $color; ?>;
228
+ <?php endif; ?>
229
+ <?php if(!empty($font_size)): ?>
230
+ font-size: <?php echo $font_size; ?>;
231
+ <?php endif; ?>
232
+
233
+ <?php if(!empty($margin)): ?>
234
+ margin: <?php echo $margin; ?>;
235
+ <?php endif; ?>
236
+ <?php if(!empty($text_align)): ?>
237
+ text-align: <?php echo $text_align; ?>;
238
+ <?php endif; ?>
239
+ <?php if(!empty($css)): ?>
240
+ <?php echo $css; ?>
241
+ <?php endif; ?>
242
+ }
243
+ <?php if(!empty($css_hover)): ?>
244
+ .layout-<?php echo $layout_id; ?> .element_<?php echo $index; ?>:hover{
245
+ <?php echo $css_hover; ?>
246
+ }
247
+ <?php endif; ?>
248
+ </style>
249
+ <?php
250
+ }
includes/layout-elements/yet-another-stars-rating/layout-elements.php ADDED
@@ -0,0 +1,537 @@