Version Description
- Feature image Enable/Disable option
Download this release
Release Info
Developer | techlabpro1 |
Plugin | The Post Grid |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 2.2
- README.txt +6 -2
- assets/js/admin.js +15 -0
- lib/classes/rtTPGInit.php +217 -196
- lib/classes/rtTPGOptions.php +23 -14
- lib/classes/rtTPGShortCode.php +4 -2
- lib/init.php +120 -98
- the-post-grid.php +12 -8
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,7 +18,7 @@ The Post Grid is a fully Responsive & Mobile friendly plugin to display your pag
|
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=V651fm6eaV4]
|
20 |
|
21 |
-
By using The Post Grid plugin you can
|
22 |
|
23 |
= Features =
|
24 |
* Fully responsive and mobile friendly.
|
@@ -39,6 +39,7 @@ By using The Post Grid plugin you can dispay your post in Grid List & Isotope vi
|
|
39 |
* Primary and Button Color control.
|
40 |
* Enable/Disable Pagination.
|
41 |
* Pagination Supported
|
|
|
42 |
|
43 |
|
44 |
|
@@ -136,6 +137,9 @@ For any bug or suggestion please mail support@radiustheme.com
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
139 |
= 2.1 =
|
140 |
* Column 5 is add with image column
|
141 |
|
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 |
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=V651fm6eaV4]
|
20 |
|
21 |
+
By using The Post Grid plugin you can display your post in Grid List & Isotope view in minutes, without any line of Coding...
|
22 |
|
23 |
= Features =
|
24 |
* Fully responsive and mobile friendly.
|
39 |
* Primary and Button Color control.
|
40 |
* Enable/Disable Pagination.
|
41 |
* Pagination Supported
|
42 |
+
* Feature image Enable/Disable option
|
43 |
|
44 |
|
45 |
|
137 |
|
138 |
== Changelog ==
|
139 |
|
140 |
+
= 2.2 =
|
141 |
+
* Feature image Enable/Disable option
|
142 |
+
|
143 |
= 2.1 =
|
144 |
* Column 5 is add with image column
|
145 |
|
assets/js/admin.js
CHANGED
@@ -44,6 +44,14 @@
|
|
44 |
}
|
45 |
});
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
$("#rt-tpg-sc-layout").on("change", function (e) {
|
48 |
thpShowHideScMeta();
|
49 |
});
|
@@ -237,6 +245,13 @@ function thpShowHideScMeta(){
|
|
237 |
jQuery(".rt-tpg-filter-item.term-filter-item").hide();
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
|
242 |
function tgpLiveReloadScript(){
|
44 |
}
|
45 |
});
|
46 |
|
47 |
+
$(document).on('change', "#rt-feature-image", function() {
|
48 |
+
if(this.checked){
|
49 |
+
jQuery(".field-holder.feature-image-options").hide();
|
50 |
+
}else{
|
51 |
+
jQuery(".field-holder.feature-image-options").show();
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
$("#rt-tpg-sc-layout").on("change", function (e) {
|
56 |
thpShowHideScMeta();
|
57 |
});
|
245 |
jQuery(".rt-tpg-filter-item.term-filter-item").hide();
|
246 |
}
|
247 |
|
248 |
+
|
249 |
+
if(jQuery("#rt-feature-image").is(':checked')){
|
250 |
+
jQuery(".field-holder.feature-image-options").hide();
|
251 |
+
}else{
|
252 |
+
jQuery(".field-holder.feature-image-options").show();
|
253 |
+
}
|
254 |
+
|
255 |
}
|
256 |
|
257 |
function tgpLiveReloadScript(){
|
lib/classes/rtTPGInit.php
CHANGED
@@ -1,199 +1,220 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if(!class_exists('rtTPGInit')):
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
endif;
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! class_exists( 'rtTPGInit' ) ):
|
4 |
+
class rtTPGInit {
|
5 |
+
|
6 |
+
function __construct() {
|
7 |
+
add_action( 'init', array( $this, 'init' ), 1 );
|
8 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
9 |
+
add_action( 'plugins_loaded', array( $this, 'the_post_grid_load_text_domain' ) );
|
10 |
+
register_activation_hook( RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array( $this, 'activate' ) );
|
11 |
+
register_deactivation_hook( RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array( $this, 'deactivate' ) );
|
12 |
+
add_filter( 'plugin_action_links_' . RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME,
|
13 |
+
array( $this, 'rt_post_grid_marketing' ) );
|
14 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'settings_admin_enqueue_scripts' ) );
|
15 |
+
add_action( 'admin_notices', array( $this, 'rt_advertisement_notice' ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
function rt_advertisement_notice() {
|
19 |
+
$current_time = new DateTime( current_time( 'mysql' ) );
|
20 |
+
$to_time = new DateTime( '2017-11-30 24:00:00' );
|
21 |
+
$interval = $current_time->diff( $to_time );
|
22 |
+
if ( $interval->days >= 0 && $interval->invert == 0 ) {
|
23 |
+
?>
|
24 |
+
<div class="notice notice-success is-dismissible">
|
25 |
+
<p><strong>40% Discount for Black Friday 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"
|
29 |
+
class="button-primary">Update to The Post Grid Pro</a>
|
30 |
+
<a href="https://www.radiustheme.com/50-discount-black-friday-limited-time/" target="_blank"
|
31 |
+
class="button">See all Other Offers</a>
|
32 |
+
</p>
|
33 |
+
<p>NOTE: Offer will Expire in November 30th, 2017 (EST)</p>
|
34 |
+
</div>
|
35 |
+
<?php }
|
36 |
+
}
|
37 |
+
|
38 |
+
function init() {
|
39 |
+
|
40 |
+
// Create the post grid post type
|
41 |
+
$labels = array(
|
42 |
+
'name' => __( 'The Post Grid', 'the-post-grid' ),
|
43 |
+
'singular_name' => __( 'The Post Grid', 'the-post-grid' ),
|
44 |
+
'add_new' => __( 'Add New Grid', 'the-post-grid' ),
|
45 |
+
'all_items' => __( 'All Grids', 'the-post-grid' ),
|
46 |
+
'add_new_item' => __( 'Add New Post Grid', 'the-post-grid' ),
|
47 |
+
'edit_item' => __( 'Edit Post Grid', 'the-post-grid' ),
|
48 |
+
'new_item' => __( 'New Post Grid', 'the-post-grid' ),
|
49 |
+
'view_item' => __( 'View Post Grid', 'the-post-grid' ),
|
50 |
+
'search_items' => __( 'Search Post Grids', 'the-post-grid' ),
|
51 |
+
'not_found' => __( 'No Post Grids found', 'the-post-grid' ),
|
52 |
+
'not_found_in_trash' => __( 'No Post Grids found in Trash', 'the-post-grid' ),
|
53 |
+
);
|
54 |
+
|
55 |
+
global $rtTPG;
|
56 |
+
|
57 |
+
register_post_type( $rtTPG->post_type, array(
|
58 |
+
'labels' => $labels,
|
59 |
+
'public' => false,
|
60 |
+
'show_ui' => true,
|
61 |
+
'_builtin' => false,
|
62 |
+
'capability_type' => 'page',
|
63 |
+
'hierarchical' => true,
|
64 |
+
'menu_icon' => $rtTPG->assetsUrl . 'images/rt-tgp-menu.png',
|
65 |
+
'rewrite' => false,
|
66 |
+
'query_var' => $rtTPG->post_type,
|
67 |
+
'supports' => array(
|
68 |
+
'title',
|
69 |
+
),
|
70 |
+
'show_in_menu' => true,
|
71 |
+
'menu_position' => 20,
|
72 |
+
) );
|
73 |
+
|
74 |
+
// register acf scripts
|
75 |
+
$scripts = array();
|
76 |
+
$styles = array();
|
77 |
+
$scripts[] = array(
|
78 |
+
'handle' => 'rt-image-load-js',
|
79 |
+
'src' => $rtTPG->assetsUrl . "vendor/isotope/imagesloaded.pkgd.min.js",
|
80 |
+
'deps' => array( 'jquery' ),
|
81 |
+
'footer' => true
|
82 |
+
);
|
83 |
+
$scripts[] = array(
|
84 |
+
'handle' => 'rt-isotope-js',
|
85 |
+
'src' => $rtTPG->assetsUrl . "vendor/isotope/isotope.pkgd.min.js",
|
86 |
+
'deps' => array( 'jquery' ),
|
87 |
+
'footer' => true
|
88 |
+
);
|
89 |
+
$scripts[] = array(
|
90 |
+
'handle' => 'rt-actual-height-js',
|
91 |
+
'src' => $rtTPG->assetsUrl . "vendor/actual-height/jquery.actual.min.js",
|
92 |
+
'deps' => array( 'jquery' ),
|
93 |
+
'footer' => true
|
94 |
+
);
|
95 |
+
$scripts[] = array(
|
96 |
+
'handle' => 'rt-tpg-js',
|
97 |
+
'src' => $rtTPG->assetsUrl . "js/rttpg.js",
|
98 |
+
'deps' => array( 'jquery' ),
|
99 |
+
'footer' => true
|
100 |
+
);
|
101 |
+
// register acf styles
|
102 |
+
$styles['rt-fontawsome'] = $rtTPG->assetsUrl . 'vendor/font-awesome/css/font-awesome.min.css';
|
103 |
+
$styles['rt-tpg-css'] = $rtTPG->assetsUrl . 'css/thepostgrid.css';
|
104 |
+
|
105 |
+
if ( is_admin() ) {
|
106 |
+
$scripts[] = array(
|
107 |
+
'handle' => 'ace_code_highlighter_js',
|
108 |
+
'src' => $rtTPG->assetsUrl . "vendor/ace/ace.js",
|
109 |
+
'deps' => null,
|
110 |
+
'footer' => true
|
111 |
+
);
|
112 |
+
$scripts[] = array(
|
113 |
+
'handle' => 'ace_mode_js',
|
114 |
+
'src' => $rtTPG->assetsUrl . "vendor/ace/mode-css.js",
|
115 |
+
'deps' => array( 'ace_code_highlighter_js' ),
|
116 |
+
'footer' => true
|
117 |
+
);
|
118 |
+
|
119 |
+
$scripts[] = array(
|
120 |
+
'handle' => 'rt-select2-js',
|
121 |
+
'src' => $rtTPG->assetsUrl . "vendor/select2/select2.min.js",
|
122 |
+
'deps' => array( 'jquery' ),
|
123 |
+
'footer' => false
|
124 |
+
);
|
125 |
+
$scripts[] = array(
|
126 |
+
'handle' => 'rt-tpg-admin',
|
127 |
+
'src' => $rtTPG->assetsUrl . "js/admin.js",
|
128 |
+
'deps' => array( 'jquery' ),
|
129 |
+
'footer' => true
|
130 |
+
);
|
131 |
+
$styles['rt-select2-css'] = $rtTPG->assetsUrl . 'vendor/select2/select2.css';
|
132 |
+
$styles['rt-select2-bootstrap-css'] = $rtTPG->assetsUrl . 'vendor/select2/select2-bootstrap.css';
|
133 |
+
$styles['rt-tpg-admin'] = $rtTPG->assetsUrl . 'css/admin.css';
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
foreach ( $scripts as $script ) {
|
138 |
+
wp_register_script( $script['handle'], $script['src'], $script['deps'], $rtTPG->options['version'],
|
139 |
+
$script['footer'] );
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
foreach ( $styles as $k => $v ) {
|
144 |
+
wp_register_style( $k, $v, false, $rtTPG->options['version'] );
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
function admin_menu() {
|
149 |
+
global $rtTPG;
|
150 |
+
add_submenu_page( 'edit.php?post_type=' . $rtTPG->post_type, __( 'Settings' ), __( 'Settings' ),
|
151 |
+
'administrator', 'rttpg_settings', array( $this, 'rttpg_settings' ) );
|
152 |
+
}
|
153 |
+
|
154 |
+
function rttpg_settings() {
|
155 |
+
global $rtTPG;
|
156 |
+
$rtTPG->render( 'settings.settings' );
|
157 |
+
}
|
158 |
+
|
159 |
+
public function the_post_grid_load_text_domain() {
|
160 |
+
load_plugin_textdomain( 'the-post-grid', false, RT_THE_POST_GRID_LANGUAGE_PATH );
|
161 |
+
}
|
162 |
+
|
163 |
+
function activate() {
|
164 |
+
$this->insertDefaultData();
|
165 |
+
}
|
166 |
+
|
167 |
+
function deactivate() {
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
private function insertDefaultData() {
|
172 |
+
global $rtTPG;
|
173 |
+
update_option( $rtTPG->options['installed_version'], $rtTPG->options['version'] );
|
174 |
+
if ( ! get_option( $rtTPG->options['settings'] ) ) {
|
175 |
+
update_option( $rtTPG->options['settings'], $rtTPG->defaultSettings );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
function rt_post_grid_marketing( $links ) {
|
180 |
+
$links[] = '<a target="_blank" href="' . esc_url( 'http://demo.radiustheme.com/wordpress/plugins/the-post-grid/' ) . '">Demo</a>';
|
181 |
+
$links[] = '<a target="_blank" href="' . esc_url( 'https://www.radiustheme.com/how-to-setup-configure-the-post-grid-free-version-for-wordpress/' ) . '">Documentation</a>';
|
182 |
+
$links[] = '<a target="_blank" href="' . esc_url( 'https://www.radiustheme.com/the-post-grid-pro-for-wordpress/' ) . '">Get Pro</a>';
|
183 |
+
|
184 |
+
return $links;
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
function settings_admin_enqueue_scripts() {
|
189 |
+
global $pagenow, $typenow, $rtTPG;
|
190 |
+
|
191 |
+
// validate page
|
192 |
+
if ( ! in_array( $pagenow, array( 'edit.php' ) ) ) {
|
193 |
+
return;
|
194 |
+
}
|
195 |
+
if ( $typenow != $rtTPG->post_type ) {
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
|
199 |
+
wp_enqueue_script( array(
|
200 |
+
'jquery',
|
201 |
+
'ace_code_highlighter_js',
|
202 |
+
'ace_mode_js',
|
203 |
+
'rt-tpg-admin',
|
204 |
+
) );
|
205 |
+
|
206 |
+
// styles
|
207 |
+
wp_enqueue_style( array(
|
208 |
+
'rt-tpg-admin',
|
209 |
+
) );
|
210 |
+
|
211 |
+
$nonce = wp_create_nonce( $rtTPG->nonceText() );
|
212 |
+
wp_localize_script( 'rt-tpg-admin', 'rttpg',
|
213 |
+
array(
|
214 |
+
'nonceID' => $rtTPG->nonceId(),
|
215 |
+
'nonce' => $nonce,
|
216 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' )
|
217 |
+
) );
|
218 |
+
}
|
219 |
+
}
|
220 |
endif;
|
lib/classes/rtTPGOptions.php
CHANGED
@@ -195,22 +195,31 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
195 |
"description" => __( "If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
|
196 |
'the-post-grid' )
|
197 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
'featured_image_size' => array(
|
199 |
-
"type"
|
200 |
-
"name"
|
201 |
-
"label"
|
202 |
-
"id"
|
203 |
-
|
204 |
-
"
|
|
|
205 |
),
|
206 |
'media_source' => array(
|
207 |
-
"type"
|
208 |
-
"name"
|
209 |
-
"label"
|
210 |
-
"id"
|
211 |
-
"
|
212 |
-
"
|
213 |
-
"
|
|
|
214 |
),
|
215 |
'tgp_excerpt_type' => array(
|
216 |
"type" => "radio",
|
@@ -292,7 +301,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
292 |
"id" => "button-text-color",
|
293 |
"class" => "rt-color"
|
294 |
),
|
295 |
-
'title_color'
|
296 |
"type" => "text",
|
297 |
"name" => "title_color",
|
298 |
"label" => "Title color",
|
195 |
"description" => __( "If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
|
196 |
'the-post-grid' )
|
197 |
),
|
198 |
+
'featured_image' => array(
|
199 |
+
"type" => "checkbox",
|
200 |
+
"name" => "featured_image",
|
201 |
+
"label" => "Feature Image",
|
202 |
+
"id" => "rt-feature-image",
|
203 |
+
"option" => 'Disable'
|
204 |
+
),
|
205 |
'featured_image_size' => array(
|
206 |
+
"type" => "select",
|
207 |
+
"name" => "featured_image_size",
|
208 |
+
"label" => "Feature Image Size",
|
209 |
+
"id" => "featured-image-size",
|
210 |
+
'holderClass' => "feature-image-options tpg-hidden",
|
211 |
+
"class" => "rt-select2",
|
212 |
+
"options" => $rtTPG->get_image_sizes()
|
213 |
),
|
214 |
'media_source' => array(
|
215 |
+
"type" => "radio",
|
216 |
+
"name" => "media_source",
|
217 |
+
"label" => "Media Source",
|
218 |
+
"id" => "media-source",
|
219 |
+
'holderClass' => "feature-image-options tpg-hidden",
|
220 |
+
"default" => 'feature_image',
|
221 |
+
"alignment" => "vertical",
|
222 |
+
"options" => $this->rtMediaSource()
|
223 |
),
|
224 |
'tgp_excerpt_type' => array(
|
225 |
"type" => "radio",
|
301 |
"id" => "button-text-color",
|
302 |
"class" => "rt-color"
|
303 |
),
|
304 |
+
'title_color' => array(
|
305 |
"type" => "text",
|
306 |
"name" => "title_color",
|
307 |
"label" => "Title color",
|
lib/classes/rtTPGShortCode.php
CHANGED
@@ -60,6 +60,7 @@ if ( ! class_exists( 'rtTPGShortCode' ) ):
|
|
60 |
if ( ! in_array( $col, array_keys( $rtTPG->rtTPGColumns() ) ) ) {
|
61 |
$col = 4;
|
62 |
}
|
|
|
63 |
$fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium" );
|
64 |
$mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image" );
|
65 |
$excerpt_type = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
|
@@ -260,7 +261,8 @@ if ( ! class_exists( 'rtTPGShortCode' ) ):
|
|
260 |
$arg['date'] = get_the_date();
|
261 |
$arg['excerpt'] = get_the_excerpt();
|
262 |
if ( $excerpt_limit ) {
|
263 |
-
$arg['excerpt'] = $rtTPG->strip_tags_content( $arg['excerpt'], $excerpt_type,
|
|
|
264 |
$excerpt_more_text );
|
265 |
}
|
266 |
|
@@ -290,7 +292,7 @@ if ( ! class_exists( 'rtTPGShortCode' ) ):
|
|
290 |
}
|
291 |
$imgSrc = null;
|
292 |
|
293 |
-
$arg['imgSrc'] = $rtTPG->getFeatureImageSrc( $pID, $fImgSize, $mediaSource );
|
294 |
|
295 |
$html .= $rtTPG->render( 'layouts/' . $layout, $arg, true );
|
296 |
|
60 |
if ( ! in_array( $col, array_keys( $rtTPG->rtTPGColumns() ) ) ) {
|
61 |
$col = 4;
|
62 |
}
|
63 |
+
$fImg = ( isset( $scMeta['featured_image'][0] ) ? true : false );
|
64 |
$fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium" );
|
65 |
$mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image" );
|
66 |
$excerpt_type = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
|
261 |
$arg['date'] = get_the_date();
|
262 |
$arg['excerpt'] = get_the_excerpt();
|
263 |
if ( $excerpt_limit ) {
|
264 |
+
$arg['excerpt'] = $rtTPG->strip_tags_content( $arg['excerpt'], $excerpt_type,
|
265 |
+
$excerpt_limit,
|
266 |
$excerpt_more_text );
|
267 |
}
|
268 |
|
292 |
}
|
293 |
$imgSrc = null;
|
294 |
|
295 |
+
$arg['imgSrc'] = !$fImg ? $rtTPG->getFeatureImageSrc( $pID, $fImgSize, $mediaSource ) : null;
|
296 |
|
297 |
$html .= $rtTPG->render( 'layouts/' . $layout, $arg, true );
|
298 |
|
lib/init.php
CHANGED
@@ -1,114 +1,136 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if(!class_exists('rtTPG')){
|
4 |
|
5 |
-
class rtTPG
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
public $assetsUrl;
|
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 |
-
global $rtTPG;
|
112 |
-
if (!is_object($rtTPG))
|
113 |
-
|
|
|
114 |
}
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! class_exists( 'rtTPG' ) ) {
|
4 |
|
5 |
+
class rtTPG {
|
6 |
+
public $options;
|
7 |
+
public $post_type;
|
8 |
+
public $assetsUrl;
|
|
|
9 |
|
10 |
+
function __construct() {
|
11 |
|
12 |
+
$this->options = array(
|
13 |
+
'settings' => 'rt_the_post_grid_settings',
|
14 |
+
'version' => RT_THE_POST_GRID_VERSION,
|
15 |
+
'installed_version' => 'rt_the_post_grid_current_version'
|
16 |
+
);
|
17 |
+
$this->defaultSettings = array(
|
18 |
+
'custom_css' => null
|
19 |
+
);
|
20 |
|
21 |
+
$this->post_type = "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 |
|
28 |
+
$this->rtLoadModel( $this->modelsPath );
|
29 |
+
$this->rtLoadClass( $this->classesPath );
|
30 |
|
31 |
+
}
|
32 |
|
33 |
+
function rtLoadModel( $dir ) {
|
34 |
+
if ( ! file_exists( $dir ) ) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
foreach ( scandir( $dir ) as $item ) {
|
38 |
+
if ( preg_match( "/.php$/i", $item ) ) {
|
39 |
+
require_once( $dir . $item );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
|
44 |
+
function rtLoadClass( $dir ) {
|
45 |
+
if ( ! file_exists( $dir ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
$classes = array();
|
49 |
+
foreach ( scandir( $dir ) as $item ) {
|
50 |
+
if ( preg_match( "/.php$/i", $item ) ) {
|
51 |
+
require_once( $dir . $item );
|
52 |
+
$className = str_replace( ".php", "", $item );
|
53 |
+
$classes[] = new $className;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
if ( $classes ) {
|
57 |
+
foreach ( $classes as $class ) {
|
58 |
+
$this->objects[] = $class;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
|
63 |
+
function loadWidget( $dir ) {
|
64 |
+
if ( ! file_exists( $dir ) ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
foreach ( scandir( $dir ) as $item ) {
|
68 |
+
if ( preg_match( "/.php$/i", $item ) ) {
|
69 |
+
require_once( $dir . $item );
|
70 |
+
$class = str_replace( ".php", "", $item );
|
71 |
+
if ( method_exists( $class, 'register_widget' ) ) {
|
72 |
+
$caller = new $class;
|
73 |
+
$caller->register_widget();
|
74 |
+
} else {
|
75 |
+
register_widget( $class );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
|
81 |
|
82 |
+
function render( $viewName, $args = array(), $return = false ) {
|
83 |
+
global $rtTPG;
|
84 |
+
$path = str_replace( ".", "/", $viewName );
|
85 |
+
$viewPath = $rtTPG->viewsPath . $path . '.php';
|
86 |
+
if ( ! file_exists( $viewPath ) ) {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
if ( $args ) {
|
90 |
+
extract( $args );
|
91 |
+
}
|
92 |
+
if ( $return ) {
|
93 |
+
ob_start();
|
94 |
+
include $viewPath;
|
95 |
|
96 |
+
return ob_get_clean();
|
97 |
+
}
|
98 |
+
include $viewPath;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Dynamicaly call any method from models class
|
103 |
+
* by pluginFramework instance
|
104 |
+
*/
|
105 |
+
function __call( $name, $args ) {
|
106 |
+
if ( ! is_array( $this->objects ) ) {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
foreach ( $this->objects as $object ) {
|
110 |
+
if ( method_exists( $object, $name ) ) {
|
111 |
+
$count = count( $args );
|
112 |
+
if ( $count == 0 ) {
|
113 |
+
return $object->$name();
|
114 |
+
} elseif ( $count == 1 ) {
|
115 |
+
return $object->$name( $args[0] );
|
116 |
+
} elseif ( $count == 2 ) {
|
117 |
+
return $object->$name( $args[0], $args[1] );
|
118 |
+
} elseif ( $count == 3 ) {
|
119 |
+
return $object->$name( $args[0], $args[1], $args[2] );
|
120 |
+
} elseif ( $count == 4 ) {
|
121 |
+
return $object->$name( $args[0], $args[1], $args[2], $args[3] );
|
122 |
+
} elseif ( $count == 5 ) {
|
123 |
+
return $object->$name( $args[0], $args[1], $args[2], $args[3], $args[4] );
|
124 |
+
} elseif ( $count == 6 ) {
|
125 |
+
return $object->$name( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5] );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
|
132 |
+
global $rtTPG;
|
133 |
+
if ( ! is_object( $rtTPG ) ) {
|
134 |
+
$rtTPG = new rtTPG;
|
135 |
+
}
|
136 |
}
|
the-post-grid.php
CHANGED
@@ -4,16 +4,20 @@
|
|
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.
|
8 |
* Text Domain: the-post-grid
|
9 |
* Domain Path: /languages
|
10 |
* Author URI: https://radiustheme.com/
|
11 |
-
*/
|
12 |
-
if ( ! defined( 'ABSPATH' ) )
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
define('
|
16 |
-
define('
|
17 |
-
define('
|
|
|
|
|
18 |
|
19 |
-
require
|
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/
|
11 |
+
*/
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
|
16 |
+
$plugin_data = get_file_data( __FILE__, array( 'Version' => 'Version' ), false );
|
17 |
+
define( 'RT_THE_POST_GRID_VERSION', $plugin_data['Version'] );
|
18 |
+
define( 'RT_THE_POST_GRID_PLUGIN_PATH', dirname( __FILE__ ) );
|
19 |
+
define( 'RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME', plugin_basename( __FILE__ ) );
|
20 |
+
define( 'RT_THE_POST_GRID_PLUGIN_URL', plugins_url( '', __FILE__ ) );
|
21 |
+
define( 'RT_THE_POST_GRID_LANGUAGE_PATH', dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
22 |
|
23 |
+
require( 'lib/init.php' );
|