Version Description
- Widget is added
Download this release
Release Info
Developer | techlabpro1 |
Plugin | The Post Grid |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2 to 2.2.1
- README.txt +5 -1
- lib/classes/rtTPGHelper.php +283 -255
- lib/classes/rtTPGInit.php +1 -1
- lib/classes/rtTPGInitWidget.php +24 -0
- lib/init.php +1 -0
- lib/widgets/RT_TPGWidget.php +81 -0
- the-post-grid.php +1 -1
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
|
5 |
Requires at least: 4
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 2.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,7 @@ By using The Post Grid plugin you can display your post in Grid List & Isotope v
|
|
40 |
* Enable/Disable Pagination.
|
41 |
* Pagination Supported
|
42 |
* Feature image Enable/Disable option
|
|
|
43 |
|
44 |
|
45 |
|
@@ -137,6 +138,9 @@ For any bug or suggestion please mail support@radiustheme.com
|
|
137 |
|
138 |
== Changelog ==
|
139 |
|
|
|
|
|
|
|
140 |
= 2.2 =
|
141 |
* Feature image Enable/Disable option
|
142 |
|
4 |
Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
|
5 |
Requires at least: 4
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 2.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
* Enable/Disable Pagination.
|
41 |
* Pagination Supported
|
42 |
* Feature image Enable/Disable option
|
43 |
+
* Widget is added
|
44 |
|
45 |
|
46 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 2.2.1 =
|
142 |
+
* Widget is added
|
143 |
+
|
144 |
= 2.2 =
|
145 |
* Feature image Enable/Disable option
|
146 |
|
lib/classes/rtTPGHelper.php
CHANGED
@@ -1,258 +1,286 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if(!class_exists('rtTPGHelper')):
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
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 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
// $excerpt = preg_replace( " ([.*?])", '', $excerpt );
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
|
|
|
|
|
|
256 |
<li>Fully responsive and mobile friendly.</li>
|
257 |
<li>55 Different Layouts</li>
|
258 |
<li>Even and Masonry Grid.</li>
|
@@ -270,9 +298,9 @@ if(!class_exists('rtTPGHelper')):
|
|
270 |
<li> and many more .......</li>
|
271 |
</ol>";
|
272 |
|
273 |
-
|
274 |
-
|
275 |
|
276 |
-
|
277 |
|
278 |
endif;
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! class_exists( 'rtTPGHelper' ) ):
|
4 |
+
|
5 |
+
class rtTPGHelper {
|
6 |
+
function verifyNonce() {
|
7 |
+
global $rtTPG;
|
8 |
+
$nonce = isset( $_REQUEST[ $this->nonceId() ] ) ? $_REQUEST[ $this->nonceId() ] : null;
|
9 |
+
$nonceText = $rtTPG->nonceText();
|
10 |
+
if ( ! wp_verify_nonce( $nonce, $nonceText ) ) {
|
11 |
+
return false;
|
12 |
+
}
|
13 |
+
|
14 |
+
return true;
|
15 |
+
}
|
16 |
+
|
17 |
+
function nonceText() {
|
18 |
+
return "rttpg_nonce_secret";
|
19 |
+
}
|
20 |
+
|
21 |
+
function nonceId() {
|
22 |
+
return "rttpg_nonce";
|
23 |
+
}
|
24 |
+
|
25 |
+
function rtAllOptionFields() {
|
26 |
+
global $rtTPG;
|
27 |
+
$fields = array();
|
28 |
+
$fieldsA = array_merge(
|
29 |
+
$rtTPG->rtTPGCommonFilterFields(),
|
30 |
+
$rtTPG->rtTPGLayoutSettingFields(),
|
31 |
+
$rtTPG->rtTPGStyleFields()
|
32 |
+
);
|
33 |
+
foreach ( $fieldsA as $field ) {
|
34 |
+
$fields[] = $field;
|
35 |
+
}
|
36 |
+
array_push( $fields, $rtTPG->rtTPGPostType() );
|
37 |
+
array_push( $fields, $rtTPG->rtTPAdvanceFilters() );
|
38 |
+
array_push( $fields, $rtTPG->itemFields() );
|
39 |
+
|
40 |
+
return $fields;
|
41 |
+
}
|
42 |
+
|
43 |
+
function rt_get_all_term_by_taxonomy( $taxonomy = null ) {
|
44 |
+
$terms = array();
|
45 |
+
if ( $taxonomy ) {
|
46 |
+
$tList = get_terms( array( $taxonomy ), array( 'hide_empty' => 0 ) );
|
47 |
+
if ( is_array( $tList ) && ! empty( $tList ) && empty( $tList['errors'] ) ) {
|
48 |
+
foreach ( $tList as $term ) {
|
49 |
+
$terms[ $term->term_id ] = $term->name;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
return $terms;
|
55 |
+
}
|
56 |
+
|
57 |
+
function rt_get_taxonomy_for_isotope_filter( $post_type = null ) {
|
58 |
+
if ( ! $post_type ) {
|
59 |
+
$post_type = get_post_meta( get_the_ID(), 'tpg_post_type', true );
|
60 |
+
}
|
61 |
+
if ( ! $post_type ) {
|
62 |
+
$post_type = 'post';
|
63 |
+
}
|
64 |
+
|
65 |
+
return $this->rt_get_all_taxonomy_by_post_type( $post_type );
|
66 |
+
}
|
67 |
+
|
68 |
+
function rt_get_all_taxonomy_by_post_type( $post_type = null ) {
|
69 |
+
$taxonomies = array();
|
70 |
+
if ( $post_type && post_type_exists( $post_type ) ) {
|
71 |
+
$taxObj = get_object_taxonomies( $post_type, 'objects' );
|
72 |
+
if ( is_array( $taxObj ) && ! empty( $taxObj ) ) {
|
73 |
+
foreach ( $taxObj as $tKey => $taxonomy ) {
|
74 |
+
$taxonomies[ $tKey ] = $taxonomy->label;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
if ( $post_type == 'post' ) {
|
79 |
+
unset( $taxonomies['post_format'] );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $taxonomies;
|
83 |
+
}
|
84 |
+
|
85 |
+
function rt_get_users() {
|
86 |
+
$users = array();
|
87 |
+
$u = get_users();
|
88 |
+
if ( ! empty( $u ) ) {
|
89 |
+
foreach ( $u as $user ) {
|
90 |
+
$users[ $user->ID ] = $user->display_name;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
return $users;
|
95 |
+
}
|
96 |
+
|
97 |
+
function getAllTPGShortCodeList() {
|
98 |
+
global $rtTPG;
|
99 |
+
$scList = null;
|
100 |
+
$scQ = get_posts( array(
|
101 |
+
'post_type' => $rtTPG->post_type,
|
102 |
+
'order_by' => 'title',
|
103 |
+
'order' => 'ASC',
|
104 |
+
'post_status' => 'publish',
|
105 |
+
'posts_per_page' => - 1
|
106 |
+
) );
|
107 |
+
if ( ! empty( $scQ ) ) {
|
108 |
+
foreach ( $scQ as $sc ) {
|
109 |
+
$scList[ $sc->ID ] = $sc->post_title;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
return $scList;
|
114 |
+
}
|
115 |
+
|
116 |
+
function rtFieldGenerator( $fields = array(), $multi = false ) {
|
117 |
+
$html = null;
|
118 |
+
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
119 |
+
$rtField = new rtTPGField();
|
120 |
+
if ( $multi ) {
|
121 |
+
foreach ( $fields as $field ) {
|
122 |
+
$html .= $rtField->Field( $field );
|
123 |
+
}
|
124 |
+
} else {
|
125 |
+
$html .= $rtField->Field( $fields );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
return $html;
|
130 |
+
}
|
131 |
+
|
132 |
+
function rtFieldGeneratorBackup( $fields = array(), $multi = false ) {
|
133 |
+
$html = null;
|
134 |
+
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
135 |
+
$rtField = new rtTPGField();
|
136 |
+
if ( $multi ) {
|
137 |
+
$i = 0;
|
138 |
+
$trigger = 0;
|
139 |
+
foreach ( $fields as $field ) {
|
140 |
+
$html .= ( $trigger == 0 ? "<div class='rt-row'>" : null );
|
141 |
+
$html .= $rtField->Field( $field );
|
142 |
+
$i ++;
|
143 |
+
$trigger ++;
|
144 |
+
if ( $trigger == 2 || count( $fields ) == $i ) {
|
145 |
+
$html .= "</div>";
|
146 |
+
$trigger = 0;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
} else {
|
150 |
+
$html .= "<div class='rt-row'>";
|
151 |
+
$html .= $rtField->Field( $fields );
|
152 |
+
$html .= "</div>";
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return $html;
|
157 |
+
}
|
158 |
+
|
159 |
+
function get_image_sizes() {
|
160 |
+
global $_wp_additional_image_sizes;
|
161 |
+
|
162 |
+
$sizes = array();
|
163 |
+
|
164 |
+
foreach ( get_intermediate_image_sizes() as $_size ) {
|
165 |
+
if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
166 |
+
$sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
|
167 |
+
$sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
|
168 |
+
$sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
|
169 |
+
} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
|
170 |
+
$sizes[ $_size ] = array(
|
171 |
+
'width' => $_wp_additional_image_sizes[ $_size ]['width'],
|
172 |
+
'height' => $_wp_additional_image_sizes[ $_size ]['height'],
|
173 |
+
'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
|
174 |
+
);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
$imgSize = array();
|
179 |
+
foreach ( $sizes as $key => $img ) {
|
180 |
+
$imgSize[ $key ] = ucfirst( $key ) . " ({$img['width']}*{$img['height']})";
|
181 |
+
}
|
182 |
+
|
183 |
+
return $imgSize;
|
184 |
+
}
|
185 |
+
|
186 |
+
function getFeatureImageSrc( $post_id = null, $fImgSize = 'medium', $mediaSource = 'feature_image' ) {
|
187 |
+
$imgSrc = null;
|
188 |
+
if ( $mediaSource == 'feature_image' ) {
|
189 |
+
if ( $aID = get_post_thumbnail_id( $post_id ) ) {
|
190 |
+
$image = wp_get_attachment_image_src( $aID, $fImgSize );
|
191 |
+
$imgSrc = $image[0];
|
192 |
+
}
|
193 |
+
} else if ( $mediaSource == 'first_image' ) {
|
194 |
+
if ( $img = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content( $post_id ),
|
195 |
+
$matches ) ) {
|
196 |
+
$imgSrc = $matches[1][0];
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
return $imgSrc;
|
201 |
+
}
|
202 |
+
|
203 |
+
function strip_tags_content( $excerpt, $type = "character", $limit = 0, $more = null ) {
|
204 |
+
$type = ( $type == "character" || $type == "word" ? $type : "character" );
|
205 |
+
/* $excerpt = preg_replace( '@<(\w+)\b.*?>.*?</\1>@si', '', $excerpt );*/
|
206 |
+
$excerpt = preg_replace( '`\[[^\]]*\]`', '', $excerpt );
|
207 |
+
$excerpt = strip_shortcodes( $excerpt );
|
208 |
+
$excerpt = preg_replace( '`[[^]]*]`', '', $excerpt );
|
209 |
+
$excerpt = str_replace( '…', '', $excerpt );
|
210 |
// $excerpt = preg_replace( " ([.*?])", '', $excerpt );
|
211 |
+
$oldExcerpt = $excerpt;
|
212 |
+
if ( $type == "word" ) {
|
213 |
+
$limit = $limit + 1;
|
214 |
+
$excerpt = explode( ' ', $excerpt, $limit );
|
215 |
+
if ( count( $excerpt ) >= $limit ) {
|
216 |
+
array_pop( $excerpt );
|
217 |
+
$excerpt = implode( " ", $excerpt );
|
218 |
+
$excerpt = ( $more ? $excerpt . " " . $more : $excerpt );
|
219 |
+
} else {
|
220 |
+
$excerpt = $oldExcerpt;
|
221 |
+
}
|
222 |
+
} else {
|
223 |
+
if ( $limit > 0 && strlen( $excerpt ) > $limit ) {
|
224 |
+
$excerpt = substr( $excerpt, 0, $limit );
|
225 |
+
$excerpt = substr( $excerpt, 0, strripos( $excerpt, " " ) );
|
226 |
+
$excerpt = ( $more ? $excerpt . " " . $more : $excerpt );
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
return $excerpt;
|
231 |
+
}
|
232 |
+
|
233 |
+
|
234 |
+
function rt_pagination( $pages = '', $range = 4 ) {
|
235 |
+
|
236 |
+
$html = null;
|
237 |
+
$showitems = ( $range * 2 ) + 1;
|
238 |
+
global $paged;
|
239 |
+
if ( empty( $paged ) ) {
|
240 |
+
$paged = 1;
|
241 |
+
}
|
242 |
+
if ( $pages == '' ) {
|
243 |
+
global $wp_query;
|
244 |
+
$pages = $wp_query->max_num_pages;
|
245 |
+
if ( ! $pages ) {
|
246 |
+
$pages = 1;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
if ( 1 != $pages ) {
|
251 |
+
|
252 |
+
$html .= '<div class="rt-pagination">';
|
253 |
+
$html .= '<ul class="pagination">';
|
254 |
+
|
255 |
+
if ( $paged > 1 && $showitems < $pages ) {
|
256 |
+
$html .= "<li><a href='" . get_pagenum_link( $paged - 1 ) . "' aria-label='Previous'><i class='fa fa-chevron-left' aria-hidden='true'></i></li>";
|
257 |
+
}
|
258 |
+
|
259 |
+
for ( $i = 1; $i <= $pages; $i ++ ) {
|
260 |
+
|
261 |
+
if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
|
262 |
+
$html .= ( $paged == $i ) ? "<li class=\"active\"><span>" . $i . "</span>
|
263 |
+
|
264 |
+
</li>" : "<li><a href='" . get_pagenum_link( $i ) . "'>" . $i . "</a></li>";
|
265 |
+
|
266 |
+
}
|
267 |
+
|
268 |
+
}
|
269 |
+
|
270 |
+
if ( $paged < $pages && $showitems < $pages ) {
|
271 |
+
$html .= "<li><a href=\"" . get_pagenum_link( $paged + 1 ) . "\" aria-label='Next'><i class='fa fa-chevron-right' aria-hidden='true'></i></a></li>";
|
272 |
+
}
|
273 |
+
|
274 |
+
$html .= "</ul>";
|
275 |
+
$html .= "</div>";
|
276 |
+
}
|
277 |
+
|
278 |
+
return $html;
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
function get_pro_feature_list() {
|
283 |
+
$html = "<ol>
|
284 |
<li>Fully responsive and mobile friendly.</li>
|
285 |
<li>55 Different Layouts</li>
|
286 |
<li>Even and Masonry Grid.</li>
|
298 |
<li> and many more .......</li>
|
299 |
</ol>";
|
300 |
|
301 |
+
return $html;
|
302 |
+
}
|
303 |
|
304 |
+
}
|
305 |
|
306 |
endif;
|
lib/classes/rtTPGInit.php
CHANGED
@@ -22,7 +22,7 @@ if ( ! class_exists( 'rtTPGInit' ) ):
|
|
22 |
if ( $interval->days >= 0 && $interval->invert == 0 ) {
|
23 |
?>
|
24 |
<div class="notice notice-success is-dismissible">
|
25 |
-
<p><strong>40% Discount for
|
26 |
<p>No Coupon code discount auto apply in Checkout</p>
|
27 |
<p>
|
28 |
<a href="https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/" target="_blank"
|
22 |
if ( $interval->days >= 0 && $interval->invert == 0 ) {
|
23 |
?>
|
24 |
<div class="notice notice-success is-dismissible">
|
25 |
+
<p><strong>40% Discount for Cyber Monday Limited Time Offer!!</strong></p>
|
26 |
<p>No Coupon code discount auto apply in Checkout</p>
|
27 |
<p>
|
28 |
<a href="https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/" target="_blank"
|
lib/classes/rtTPGInitWidget.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('rtTPGInitWidget')):
|
4 |
+
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
class rtTPGInitWidget
|
9 |
+
{
|
10 |
+
|
11 |
+
function __construct()
|
12 |
+
{
|
13 |
+
add_action( 'widgets_init', array($this, 'initWidget'));
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
function initWidget(){
|
18 |
+
global $rtTPG;
|
19 |
+
$rtTPG->loadWidget( $rtTPG->widgetsPath );
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
endif;
|
lib/init.php
CHANGED
@@ -22,6 +22,7 @@ if ( ! class_exists( 'rtTPG' ) ) {
|
|
22 |
$this->libPath = dirname( __FILE__ );
|
23 |
$this->modelsPath = $this->libPath . '/models/';
|
24 |
$this->classesPath = $this->libPath . '/classes/';
|
|
|
25 |
$this->viewsPath = $this->libPath . '/views/';
|
26 |
$this->assetsUrl = RT_THE_POST_GRID_PLUGIN_URL . '/assets/';
|
27 |
|
22 |
$this->libPath = dirname( __FILE__ );
|
23 |
$this->modelsPath = $this->libPath . '/models/';
|
24 |
$this->classesPath = $this->libPath . '/classes/';
|
25 |
+
$this->widgetsPath = $this->libPath . '/widgets/';
|
26 |
$this->viewsPath = $this->libPath . '/views/';
|
27 |
$this->assetsUrl = RT_THE_POST_GRID_PLUGIN_URL . '/assets/';
|
28 |
|
lib/widgets/RT_TPGWidget.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('RT_TPGWidget')):
|
4 |
+
|
5 |
+
|
6 |
+
/**
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
class RT_TPGWidget extends WP_Widget
|
10 |
+
{
|
11 |
+
|
12 |
+
function __construct() {
|
13 |
+
|
14 |
+
$widget_ops = array( 'classname' => 'widget_tpg_post_grid', 'description' => __('Display the post grid.', 'the-post-grid') );
|
15 |
+
parent::__construct( 'widget_tpg_post_grid', __('The Post Grid', 'the-post-grid'), $widget_ops);
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* display the widgets on the screen.
|
21 |
+
*/
|
22 |
+
function widget( $args, $instance ) {
|
23 |
+
extract( $args );
|
24 |
+
$id = ( ! empty( $instance['id'] ) ? absint( $instance['id'] ) : null );
|
25 |
+
|
26 |
+
echo $before_widget;
|
27 |
+
if ( ! empty( $instance['title'] ) ) {
|
28 |
+
echo $args['before_title'] . apply_filters( 'widget_title',
|
29 |
+
( isset( $instance['title'] ) ? $instance['title'] : "The Post Grid Pro" ) ) . $args['after_title'];
|
30 |
+
}
|
31 |
+
if(!empty($id)){
|
32 |
+
echo do_shortcode("[the-post-grid id='{$id}' ]");
|
33 |
+
}
|
34 |
+
echo $after_widget;
|
35 |
+
}
|
36 |
+
function form( $instance ) {
|
37 |
+
|
38 |
+
global $rtTPG;
|
39 |
+
$scList = $rtTPG->getAllTPGShortCodeList();
|
40 |
+
$defaults = array(
|
41 |
+
'title' => "The Post Grid",
|
42 |
+
'id' => null
|
43 |
+
);
|
44 |
+
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
45 |
+
|
46 |
+
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:',
|
47 |
+
'the-post-grid' ); ?></label>
|
48 |
+
<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>"
|
49 |
+
name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>"
|
50 |
+
style="width:100%;"/></p>
|
51 |
+
|
52 |
+
<p><label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Select post grid',
|
53 |
+
'the-post-grid' ); ?></label>
|
54 |
+
<select id="<?php echo $this->get_field_id( 'id' ); ?>"
|
55 |
+
name="<?php echo $this->get_field_name( 'id' ); ?>">
|
56 |
+
<option value="">Select one</option>
|
57 |
+
<?php
|
58 |
+
if ( ! empty( $scList ) ) {
|
59 |
+
foreach ( $scList as $scId => $sc ) {
|
60 |
+
$selected = ($scId == $instance['id'] ? "selected" : null);
|
61 |
+
echo "<option value='{$scId}' {$selected}>{$sc}</option>";
|
62 |
+
}
|
63 |
+
}
|
64 |
+
?>
|
65 |
+
</select></p>
|
66 |
+
<?php
|
67 |
+
}
|
68 |
+
public function update( $new_instance, $old_instance ) {
|
69 |
+
|
70 |
+
$instance = array();
|
71 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
72 |
+
$instance['id'] = ( ! empty( $new_instance['id'] ) ) ? absint( $new_instance['id'] ) : '';
|
73 |
+
|
74 |
+
return $instance;
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
endif;
|
the-post-grid.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
|
5 |
* Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
|
6 |
* Author: RadiusTheme
|
7 |
-
* Version: 2.2
|
8 |
* Text Domain: the-post-grid
|
9 |
* Domain Path: /languages
|
10 |
* Author URI: https://radiustheme.com/
|
4 |
* Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
|
5 |
* Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
|
6 |
* Author: RadiusTheme
|
7 |
+
* Version: 2.2.1
|
8 |
* Text Domain: the-post-grid
|
9 |
* Domain Path: /languages
|
10 |
* Author URI: https://radiustheme.com/
|