Version Description
(19 May 2017) = * [] Resolved WPML language translate issue while news is being displayed with taxonomy. * [] Updated 'How it Work' page. * [*] Resolved post status issue. Now only 'Published' post will be displayed.
Download this release
Release Info
Developer | anoopranawat |
Plugin | WP News and Scrolling Widgets |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.11 to 3.3.1
- admin/wpnw-how-it-work.php +25 -11
- css/stylenews.css +9 -4
- readme.txt +24 -9
- sp-news-and-widget.php +211 -131
- widget_function.php +41 -20
admin/wpnw-how-it-work.php
CHANGED
@@ -19,7 +19,7 @@ add_action('admin_menu', 'wpnw_register_design_page');
|
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
function wpnw_register_design_page() {
|
22 |
-
add_submenu_page( 'edit.php?post_type='.WPNW_POST_TYPE, __('How it works
|
23 |
}
|
24 |
|
25 |
/**
|
@@ -140,7 +140,7 @@ function wpnw_help_tabs() {
|
|
140 |
* @since 1.0.0
|
141 |
*/
|
142 |
function wpnw_howitwork_page() { ?>
|
143 |
-
|
144 |
<style type="text/css">
|
145 |
.wpos-pro-box .hndle{background-color:#0073AA; color:#fff;}
|
146 |
.wpos-pro-box .postbox{background:#dbf0fa none repeat scroll 0 0; border:1px solid #0073aa; color:#191e23;}
|
@@ -152,7 +152,7 @@ function wpnw_howitwork_page() { ?>
|
|
152 |
<div class="post-box-container">
|
153 |
<div id="poststuff">
|
154 |
<div id="post-body" class="metabox-holder columns-2">
|
155 |
-
|
156 |
<!--How it workd HTML -->
|
157 |
<div id="post-body-content">
|
158 |
<div class="metabox-holder">
|
@@ -160,7 +160,7 @@ function wpnw_howitwork_page() { ?>
|
|
160 |
<div class="postbox">
|
161 |
|
162 |
<h3 class="hndle">
|
163 |
-
<span><?php _e( 'How It Works - Display and
|
164 |
</h3>
|
165 |
|
166 |
<div class="inside">
|
@@ -168,22 +168,22 @@ function wpnw_howitwork_page() { ?>
|
|
168 |
<tbody>
|
169 |
<tr>
|
170 |
<th>
|
171 |
-
<label><?php _e('Geeting Started
|
172 |
</th>
|
173 |
<td>
|
174 |
<ul>
|
175 |
<li><?php _e('Step-1: This plugin create a News menu tab in WordPress menu with custom post type.".', 'sp-news-and-widget'); ?></li>
|
176 |
-
<li><?php _e('Step-2: Go to "News
|
177 |
-
<li><?php _e('Step-3: Add
|
178 |
-
<li><?php _e('Step-4: Repeat this process and add multiple news item', 'sp-news-and-widget'); ?></li>
|
179 |
-
<li><?php _e('Step-4: To display news category wise you can use category shortcode under "News
|
180 |
</ul>
|
181 |
</td>
|
182 |
</tr>
|
183 |
|
184 |
<tr>
|
185 |
<th>
|
186 |
-
<label><?php _e('How Shortcode Works', 'sp-news-and-widget');
|
187 |
</th>
|
188 |
<td>
|
189 |
<ul>
|
@@ -196,7 +196,7 @@ function wpnw_howitwork_page() { ?>
|
|
196 |
|
197 |
<tr>
|
198 |
<th>
|
199 |
-
<label><?php _e('All Shortcodes', 'sp-news-and-widget');
|
200 |
</th>
|
201 |
<td>
|
202 |
<span class="wpnwm-shortcode-preview">[sp_news grid="list"]</span> – <?php _e('News in List View', 'sp-news-and-widget'); ?> <br />
|
@@ -259,6 +259,20 @@ function wpnw_howitwork_page() { ?>
|
|
259 |
</div><!-- .meta-box-sortables ui-sortable -->
|
260 |
</div><!-- .metabox-holder -->
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
<!-- Help to improve this plugin! -->
|
263 |
<div class="metabox-holder">
|
264 |
<div class="meta-box-sortables ui-sortable">
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
function wpnw_register_design_page() {
|
22 |
+
add_submenu_page( 'edit.php?post_type='.WPNW_POST_TYPE, __('How it works - WP News and Scrolling Widgets', 'sp-news-and-widget'), __('How It Works', 'sp-news-and-widget'), 'edit_posts', 'wpnw-designs', 'wpnw_designs_page' );
|
23 |
}
|
24 |
|
25 |
/**
|
140 |
* @since 1.0.0
|
141 |
*/
|
142 |
function wpnw_howitwork_page() { ?>
|
143 |
+
|
144 |
<style type="text/css">
|
145 |
.wpos-pro-box .hndle{background-color:#0073AA; color:#fff;}
|
146 |
.wpos-pro-box .postbox{background:#dbf0fa none repeat scroll 0 0; border:1px solid #0073aa; color:#191e23;}
|
152 |
<div class="post-box-container">
|
153 |
<div id="poststuff">
|
154 |
<div id="post-body" class="metabox-holder columns-2">
|
155 |
+
|
156 |
<!--How it workd HTML -->
|
157 |
<div id="post-body-content">
|
158 |
<div class="metabox-holder">
|
160 |
<div class="postbox">
|
161 |
|
162 |
<h3 class="hndle">
|
163 |
+
<span><?php _e( 'How It Works - Display and Shortcode', 'sp-news-and-widget' ); ?></span>
|
164 |
</h3>
|
165 |
|
166 |
<div class="inside">
|
168 |
<tbody>
|
169 |
<tr>
|
170 |
<th>
|
171 |
+
<label><?php _e('Geeting Started', 'sp-news-and-widget'); ?></label>
|
172 |
</th>
|
173 |
<td>
|
174 |
<ul>
|
175 |
<li><?php _e('Step-1: This plugin create a News menu tab in WordPress menu with custom post type.".', 'sp-news-and-widget'); ?></li>
|
176 |
+
<li><?php _e('Step-2: Go to "News > Add news item tab".', 'sp-news-and-widget'); ?></li>
|
177 |
+
<li><?php _e('Step-3: Add news title, description, category, and image as featured image.', 'sp-news-and-widget'); ?></li>
|
178 |
+
<li><?php _e('Step-4: Repeat this process and add multiple news item.', 'sp-news-and-widget'); ?></li>
|
179 |
+
<li><?php _e('Step-4: To display news category wise you can use category shortcode under "News > News category"', 'sp-news-and-widget'); ?></li>
|
180 |
</ul>
|
181 |
</td>
|
182 |
</tr>
|
183 |
|
184 |
<tr>
|
185 |
<th>
|
186 |
+
<label><?php _e('How Shortcode Works', 'sp-news-and-widget'); ?></label>
|
187 |
</th>
|
188 |
<td>
|
189 |
<ul>
|
196 |
|
197 |
<tr>
|
198 |
<th>
|
199 |
+
<label><?php _e('All Shortcodes', 'sp-news-and-widget'); ?></label>
|
200 |
</th>
|
201 |
<td>
|
202 |
<span class="wpnwm-shortcode-preview">[sp_news grid="list"]</span> – <?php _e('News in List View', 'sp-news-and-widget'); ?> <br />
|
259 |
</div><!-- .meta-box-sortables ui-sortable -->
|
260 |
</div><!-- .metabox-holder -->
|
261 |
|
262 |
+
<div class="metabox-holder wpos-pro-box">
|
263 |
+
<div class="meta-box-sortables ui-sortable">
|
264 |
+
<div class="postbox">
|
265 |
+
<h3 class="hndle">
|
266 |
+
<span><?php _e('Need PRO Support?', 'sp-news-and-widget'); ?></span>
|
267 |
+
</h3>
|
268 |
+
<div class="inside">
|
269 |
+
<p><?php _e('Hire our experts for WordPress website support.', 'sp-news-and-widget'); ?></p>
|
270 |
+
<p><a class="button button-primary wpos-button-full" href="https://www.wponlinesupport.com/projobs-support/?utm_source=hp&event=projobs" target="_blank"><?php _e('PRO Support', 'sp-news-and-widget'); ?></a></p>
|
271 |
+
</div><!-- .inside -->
|
272 |
+
</div><!-- #general -->
|
273 |
+
</div><!-- .meta-box-sortables ui-sortable -->
|
274 |
+
</div><!-- .metabox-holder -->
|
275 |
+
|
276 |
<!-- Help to improve this plugin! -->
|
277 |
<div class="metabox-holder">
|
278 |
<div class="meta-box-sortables ui-sortable">
|
css/stylenews.css
CHANGED
@@ -51,10 +51,15 @@
|
|
51 |
.news_thumb_left a{display:block; margin-right:10px;}
|
52 |
.news_thumb_left img{height: 100% !important;width: 100% !important;object-fit: cover;object-position: top center; }
|
53 |
.news_thumb_right{display:table-cell; vertical-align:top; }
|
54 |
-
.news_pagination{clear:both; padding:20px 0; float:left; width:100
|
55 |
-
.button-news-p{width:48%; float:right; text-align:right; padding-right:15px;}
|
56 |
-
.button-news-n{width:48%; float:left; text-align:left; padding-left:15px;}
|
57 |
-
.
|
|
|
|
|
|
|
|
|
|
|
58 |
.recent-news-items{clear:both;}
|
59 |
.recent-news-items.no_p h6{margin:5px 0 !important;}
|
60 |
.recent-news-items p{font-size:13px !important; margin-bottom:10px !important}
|
51 |
.news_thumb_left a{display:block; margin-right:10px;}
|
52 |
.news_thumb_left img{height: 100% !important;width: 100% !important;object-fit: cover;object-position: top center; }
|
53 |
.news_thumb_right{display:table-cell; vertical-align:top; }
|
54 |
+
.news_pagination{clear:both; padding:20px 0; float:left; width:100%;text-align: center;}
|
55 |
+
.news_pagination .button-news-p{width:48%; float:right; text-align:right; padding-right:15px;}
|
56 |
+
.news_pagination .button-news-n{width:48%; float:left; text-align:left; padding-left:15px;}
|
57 |
+
.news_pagination a,
|
58 |
+
.news_pagination a{color: #fff !important;background: #333;padding: 7px 10px;display: inline-block;text-align: center;line-height: normal;box-shadow: none;text-shadow: none;font-size: 14px;text-transform: uppercase;border: 1px solid #333;text-decoration: none !important;}
|
59 |
+
.news_pagination a:hover,
|
60 |
+
.news_pagination a:focus,
|
61 |
+
.news_pagination a:hover,
|
62 |
+
.news_pagination a:focus{color: #333 !important;background: transparent;}
|
63 |
.recent-news-items{clear:both;}
|
64 |
.recent-news-items.no_p h6{margin:5px 0 !important;}
|
65 |
.recent-news-items p{font-size:13px !important; margin-bottom:10px !important}
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== WP News and Scrolling Widgets ===
|
2 |
-
Contributors: wponlinesupport, anoopranawat
|
3 |
-
Tags: wponlinesupport, wordpress news plugin, news website, main news page scrolling , wordpress vertical news plugin widget, wordpress horizontal news plugin widget , Free scrolling news wordpress plugin, Free scrolling news widget wordpress plugin, WordPress set post or page as news, WordPress dynamic news, news, latest news, custom post type, cpt, widget, vertical news scrolling widget, news widget
|
4 |
Requires at least: 3.1
|
5 |
-
Tested up to: 4.
|
6 |
Author URI: http://wponlinesupport.com
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
@@ -18,6 +18,8 @@ View [DEMO](http://wponlinesupport.com/wp-plugin/sp-news-and-scrolling-widgets/)
|
|
18 |
|
19 |
View [PRO DEMO and Features](http://wponlinesupport.com/wp-plugin/sp-news-and-scrolling-widgets/) for additional information.
|
20 |
|
|
|
|
|
21 |
View [Masonry Add-on](http://wponlinesupport.com/wordpress-plugin-addon/masonry-addon-wp-news-widgets/) with 12 designs and 7 effects.
|
22 |
|
23 |
> <strong>Have you checked our latest News / Blog Themes?</strong><br>
|
@@ -61,6 +63,7 @@ show_date="false" content_words_limit="30" ]</code>
|
|
61 |
|
62 |
* **limit :** [sp_news limit="10"] (Display latest 10 news and then pagination).
|
63 |
* **category :** [sp_news category="category_id"] (Display News categories wise).
|
|
|
64 |
* **grid :** [sp_news grid="2"] OR [sp_news grid="list"] (Display News in Grid formats. To display News in list view, Use grid="list").
|
65 |
* **show_date :** [sp_news show_date="false"] (Display News date OR not. By default value is "True". Options are "ture OR false")
|
66 |
* **show_content :** [sp_news show_content="true" ] (Display News Short content OR not. By default value is "True". Options are "ture OR false").
|
@@ -157,6 +160,14 @@ Yse <code> [sp_news] </code>
|
|
157 |
|
158 |
== Changelog ==
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
= 3.2.11 (09/12/2016) =
|
161 |
* [*] Resolved conflict when 'WP News and Widget - Masonry Layout' plugin is activated.
|
162 |
|
@@ -237,14 +248,18 @@ Yse <code> [sp_news] </code>
|
|
237 |
* Admin setting page
|
238 |
|
239 |
= 1.0 =
|
240 |
-
* Initial release
|
241 |
-
* Adds custom post type for News item
|
242 |
-
* Adds all and single page templates for news
|
243 |
-
* Adds Letest news widget
|
244 |
-
* Adds Vertical news scrolling widget
|
245 |
|
246 |
== Upgrade Notice ==
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
= 3.2.11 (09/12/2016) =
|
249 |
* [*] Resolved conflict when 'WP News and Widget - Masonry Layout' plugin is activated.
|
250 |
|
@@ -323,4 +338,4 @@ Setting page for main news page vertical and horizontal news scrolling
|
|
323 |
Added Vertical and horizontal news scrolling widget with setting page
|
324 |
|
325 |
= 1.0 =
|
326 |
-
Initial release
|
1 |
=== WP News and Scrolling Widgets ===
|
2 |
+
Contributors: wponlinesupport, anoopranawat
|
3 |
+
Tags: news, wponlinesupport, wordpress news plugin, news website, main news page scrolling , wordpress vertical news plugin widget, wordpress horizontal news plugin widget , Free scrolling news wordpress plugin, Free scrolling news widget wordpress plugin, WordPress set post or page as news, WordPress dynamic news, news, latest news, custom post type, cpt, widget, vertical news scrolling widget, news widget
|
4 |
Requires at least: 3.1
|
5 |
+
Tested up to: 4.8
|
6 |
Author URI: http://wponlinesupport.com
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
18 |
|
19 |
View [PRO DEMO and Features](http://wponlinesupport.com/wp-plugin/sp-news-and-scrolling-widgets/) for additional information.
|
20 |
|
21 |
+
Download our all [FREE 34 WordPress Plugins](https://www.wponlinesupport.com/wp-online-support-all-free-34-plugins/?utm_source=wp&event=fd).
|
22 |
+
|
23 |
View [Masonry Add-on](http://wponlinesupport.com/wordpress-plugin-addon/masonry-addon-wp-news-widgets/) with 12 designs and 7 effects.
|
24 |
|
25 |
> <strong>Have you checked our latest News / Blog Themes?</strong><br>
|
63 |
|
64 |
* **limit :** [sp_news limit="10"] (Display latest 10 news and then pagination).
|
65 |
* **category :** [sp_news category="category_id"] (Display News categories wise).
|
66 |
+
* **pagination_type:** [sp_news pagination_type="numeric"] (Select the pagination type for News ie "numeric" OR "next-prev" ).
|
67 |
* **grid :** [sp_news grid="2"] OR [sp_news grid="list"] (Display News in Grid formats. To display News in list view, Use grid="list").
|
68 |
* **show_date :** [sp_news show_date="false"] (Display News date OR not. By default value is "True". Options are "ture OR false")
|
69 |
* **show_content :** [sp_news show_content="true" ] (Display News Short content OR not. By default value is "True". Options are "ture OR false").
|
160 |
|
161 |
== Changelog ==
|
162 |
|
163 |
+
= 3.3.1 (19 May 2017) =
|
164 |
+
* [*] Resolved WPML language translate issue while news is being displayed with taxonomy.
|
165 |
+
* [*] Updated 'How it Work' page.
|
166 |
+
* [*] Resolved post status issue. Now only 'Published' post will be displayed.
|
167 |
+
|
168 |
+
= 3.3 (15/02/2017) =
|
169 |
+
* [+] Added new shortcode parameter "pagination_type" (Select the pagination type for News ie "numeric" OR "next-prev" ).
|
170 |
+
|
171 |
= 3.2.11 (09/12/2016) =
|
172 |
* [*] Resolved conflict when 'WP News and Widget - Masonry Layout' plugin is activated.
|
173 |
|
248 |
* Admin setting page
|
249 |
|
250 |
= 1.0 =
|
251 |
+
* Initial release.
|
|
|
|
|
|
|
|
|
252 |
|
253 |
== Upgrade Notice ==
|
254 |
|
255 |
+
= 3.3.1 (19 May 2017) =
|
256 |
+
* [*] Resolved WPML language translate issue while news is being displayed with taxonomy.
|
257 |
+
* [*] Updated 'How it Work' page.
|
258 |
+
* [*] Resolved post status issue. Now only 'Published' post will be displayed.
|
259 |
+
|
260 |
+
= 3.3 (15/02/2017) =
|
261 |
+
* [+] Added new shortcode parameter "pagination_type" (Select the pagination type for News ie "numeric" OR "next-prev" ).
|
262 |
+
|
263 |
= 3.2.11 (09/12/2016) =
|
264 |
* [*] Resolved conflict when 'WP News and Widget - Masonry Layout' plugin is activated.
|
265 |
|
338 |
Added Vertical and horizontal news scrolling widget with setting page
|
339 |
|
340 |
= 1.0 =
|
341 |
+
Initial release.
|
sp-news-and-widget.php
CHANGED
@@ -1,23 +1,22 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP News and Scrolling Widgets
|
4 |
-
Plugin URL:
|
5 |
Text Domain: sp-news-and-widget
|
6 |
Domain Path: /languages/
|
7 |
Description: A simple News and three widgets(static, scrolling and with thumbs) plugin
|
8 |
-
Version: 3.
|
9 |
Author: WP Online Support
|
10 |
-
Author URI:
|
11 |
Contributors: WP Online Support
|
12 |
*/
|
13 |
|
14 |
if( !defined( 'WPNW_VERSION' ) ) {
|
15 |
-
define( 'WPNW_VERSION', '3.
|
16 |
}
|
17 |
if( !defined( 'WPNW_DIR' ) ) {
|
18 |
define( 'WPNW_DIR', dirname( __FILE__ ) ); // Plugin dir
|
19 |
}
|
20 |
-
|
21 |
if( !defined( 'WPNW_POST_TYPE' ) ) {
|
22 |
define( 'WPNW_POST_TYPE', 'news' ); // Plugin post type
|
23 |
}
|
@@ -121,188 +120,253 @@ function news_taxonomies() {
|
|
121 |
}
|
122 |
|
123 |
function wpnaw_rewrite_flush() {
|
124 |
-
|
125 |
flush_rewrite_rules();
|
126 |
}
|
127 |
register_activation_hook( __FILE__, 'wpnaw_rewrite_flush' );
|
|
|
128 |
add_action( 'wp_enqueue_scripts','wpnawstyle_css_script' );
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
require_once( 'widget_function.php' );
|
135 |
|
136 |
function wpnaw_get_news( $atts, $content = null ){
|
137 |
-
|
138 |
-
|
139 |
-
"limit"
|
140 |
-
"category"
|
141 |
-
"grid"
|
142 |
-
"show_date"
|
143 |
-
"show_category_name"
|
144 |
-
"show_content"
|
145 |
-
"show_full_content"
|
146 |
-
"content_words_limit"
|
|
|
147 |
), $atts));
|
148 |
-
|
149 |
-
|
|
|
|
|
150 |
$posts_per_page = $limit;
|
151 |
} else {
|
152 |
$posts_per_page = '-1';
|
153 |
}
|
154 |
-
|
|
|
155 |
$cat = $category;
|
156 |
} else {
|
157 |
$cat = '';
|
158 |
}
|
159 |
-
|
|
|
160 |
$gridcol = $grid;
|
161 |
} else {
|
162 |
$gridcol = '1';
|
163 |
}
|
|
|
164 |
if( $show_date ) {
|
165 |
$showDate = $show_date;
|
166 |
} else {
|
167 |
$showDate = 'true';
|
168 |
}
|
169 |
-
|
|
|
170 |
$showCategory = $show_category_name;
|
171 |
} else {
|
172 |
$showCategory = 'true';
|
173 |
}
|
|
|
174 |
if( $show_content ) {
|
175 |
$showContent = $show_content;
|
176 |
} else {
|
177 |
$showContent = 'true';
|
178 |
}
|
179 |
-
|
|
|
180 |
$showFullContent = $show_full_content;
|
181 |
} else {
|
182 |
$showFullContent = 'false';
|
183 |
}
|
184 |
-
|
|
|
185 |
$words_limit = $content_words_limit;
|
186 |
} else {
|
187 |
$words_limit = '20';
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
ob_start();
|
190 |
|
191 |
global $paged;
|
192 |
-
if(is_home() || is_front_page()) {
|
193 |
-
$paged = get_query_var('page');
|
194 |
-
} else {
|
195 |
-
$paged = get_query_var('paged');
|
196 |
-
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
$post_type = 'news';
|
199 |
-
$orderby = '
|
200 |
$order = 'DESC';
|
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 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
<?php echo ($showDate == "true" && $showCategory == "true" && $cate_name != '') ? " / " : "";?>
|
|
|
267 |
<?php echo ($showCategory == 'true' && $cate_name != '') ? $cate_name : ""?>
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
|
|
|
|
275 |
<?php echo $cate_name; ?>
|
276 |
-
|
277 |
-
<?php }?>
|
278 |
-
<?php if($showContent == 'true'){?>
|
279 |
-
<div class="news-content-excerpt">
|
280 |
-
<?php if($showFullContent == "false" ) {
|
281 |
-
$excerpt = get_the_content();?>
|
282 |
-
<div class="news-short-content"><?php echo string_limit_newswords( $post->ID, $excerpt, $words_limit, '...'); ?></div>
|
283 |
-
<a href="<?php the_permalink(); ?>" class="news-more-link"><?php _e( 'Read More', 'sp-news-and-widget' ); ?></a>
|
284 |
-
<?php } else {
|
285 |
-
the_content();
|
286 |
-
} ?>
|
287 |
-
</div><!-- .entry-content -->
|
288 |
<?php }?>
|
289 |
-
</div>
|
290 |
-
</div>
|
291 |
-
</div><!-- #post-## -->
|
292 |
-
<?php endwhile;
|
293 |
-
endif; ?>
|
294 |
-
|
295 |
-
<div class="news_pagination">
|
296 |
-
|
297 |
-
<div class="button-news-p"><?php next_posts_link( ' Next >>', $query->max_num_pages ); ?></div>
|
298 |
-
<div class="button-news-n"><?php previous_posts_link( '<< Previous' ); ?> </div>
|
299 |
-
</div>
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
|
305 |
-
|
306 |
}
|
307 |
add_shortcode('sp_news','wpnaw_get_news');
|
308 |
|
@@ -371,7 +435,23 @@ function news_category_columns($out, $column_name, $theme_id) {
|
|
371 |
break;
|
372 |
}
|
373 |
return $out;
|
|
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
}
|
376 |
|
377 |
// How it work file, Load admin files
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP News and Scrolling Widgets
|
4 |
+
Plugin URL: https://www.wponlinesupport.com
|
5 |
Text Domain: sp-news-and-widget
|
6 |
Domain Path: /languages/
|
7 |
Description: A simple News and three widgets(static, scrolling and with thumbs) plugin
|
8 |
+
Version: 3.3.1
|
9 |
Author: WP Online Support
|
10 |
+
Author URI: https://www.wponlinesupport.com
|
11 |
Contributors: WP Online Support
|
12 |
*/
|
13 |
|
14 |
if( !defined( 'WPNW_VERSION' ) ) {
|
15 |
+
define( 'WPNW_VERSION', '3.3.1' ); // Version of plugin
|
16 |
}
|
17 |
if( !defined( 'WPNW_DIR' ) ) {
|
18 |
define( 'WPNW_DIR', dirname( __FILE__ ) ); // Plugin dir
|
19 |
}
|
|
|
20 |
if( !defined( 'WPNW_POST_TYPE' ) ) {
|
21 |
define( 'WPNW_POST_TYPE', 'news' ); // Plugin post type
|
22 |
}
|
120 |
}
|
121 |
|
122 |
function wpnaw_rewrite_flush() {
|
123 |
+
sp_cpt_news_init();
|
124 |
flush_rewrite_rules();
|
125 |
}
|
126 |
register_activation_hook( __FILE__, 'wpnaw_rewrite_flush' );
|
127 |
+
|
128 |
add_action( 'wp_enqueue_scripts','wpnawstyle_css_script' );
|
129 |
+
function wpnawstyle_css_script() {
|
130 |
+
wp_enqueue_style( 'cssnews', plugin_dir_url( __FILE__ ). 'css/stylenews.css', array(), WPNW_VERSION );
|
131 |
+
wp_enqueue_script( 'vnewsticker', plugin_dir_url( __FILE__ ) . 'js/jquery.newstape.js', array( 'jquery' ), WPNW_VERSION);
|
132 |
+
}
|
133 |
|
134 |
require_once( 'widget_function.php' );
|
135 |
|
136 |
function wpnaw_get_news( $atts, $content = null ){
|
137 |
+
// setup the query
|
138 |
+
extract(shortcode_atts(array(
|
139 |
+
"limit" => '',
|
140 |
+
"category" => '',
|
141 |
+
"grid" => '',
|
142 |
+
"show_date" => '',
|
143 |
+
"show_category_name" => '',
|
144 |
+
"show_content" => '',
|
145 |
+
"show_full_content" => '',
|
146 |
+
"content_words_limit" => '',
|
147 |
+
"pagination_type" => 'next-prev',
|
148 |
), $atts));
|
149 |
+
|
150 |
+
// Define limit
|
151 |
+
|
152 |
+
if( $limit ) {
|
153 |
$posts_per_page = $limit;
|
154 |
} else {
|
155 |
$posts_per_page = '-1';
|
156 |
}
|
157 |
+
|
158 |
+
if( $category ) {
|
159 |
$cat = $category;
|
160 |
} else {
|
161 |
$cat = '';
|
162 |
}
|
163 |
+
|
164 |
+
if( $grid ) {
|
165 |
$gridcol = $grid;
|
166 |
} else {
|
167 |
$gridcol = '1';
|
168 |
}
|
169 |
+
|
170 |
if( $show_date ) {
|
171 |
$showDate = $show_date;
|
172 |
} else {
|
173 |
$showDate = 'true';
|
174 |
}
|
175 |
+
|
176 |
+
if( $show_category_name ) {
|
177 |
$showCategory = $show_category_name;
|
178 |
} else {
|
179 |
$showCategory = 'true';
|
180 |
}
|
181 |
+
|
182 |
if( $show_content ) {
|
183 |
$showContent = $show_content;
|
184 |
} else {
|
185 |
$showContent = 'true';
|
186 |
}
|
187 |
+
|
188 |
+
if( $show_full_content ) {
|
189 |
$showFullContent = $show_full_content;
|
190 |
} else {
|
191 |
$showFullContent = 'false';
|
192 |
}
|
193 |
+
|
194 |
+
if( $content_words_limit ) {
|
195 |
$words_limit = $content_words_limit;
|
196 |
} else {
|
197 |
$words_limit = '20';
|
198 |
}
|
199 |
+
|
200 |
+
if($pagination_type == 'numeric'){
|
201 |
+
|
202 |
+
$pagination_type = 'numeric';
|
203 |
+
}else{
|
204 |
+
|
205 |
+
$pagination_type = 'next-prev';
|
206 |
+
}
|
207 |
+
|
208 |
ob_start();
|
209 |
|
210 |
global $paged;
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
+
if(is_home() || is_front_page()) {
|
213 |
+
$paged = get_query_var('page');
|
214 |
+
} else {
|
215 |
+
$paged = get_query_var('paged');
|
216 |
+
}
|
217 |
+
|
218 |
$post_type = 'news';
|
219 |
+
$orderby = 'date';
|
220 |
$order = 'DESC';
|
221 |
+
|
222 |
+
$args = array (
|
223 |
+
'post_type' => $post_type,
|
224 |
+
'post_status' => array( 'publish' ),
|
225 |
+
'orderby' => $orderby,
|
226 |
+
'order' => $order,
|
227 |
+
'posts_per_page' => $posts_per_page,
|
228 |
+
'paged' => $paged,
|
229 |
+
);
|
230 |
+
|
231 |
+
if($cat != "") {
|
232 |
+
$args['tax_query'] = array(
|
233 |
+
array(
|
234 |
+
'taxonomy' => 'news-category',
|
235 |
+
'field' => 'term_id',
|
236 |
+
'terms' => $cat
|
237 |
+
));
|
238 |
+
}
|
239 |
+
|
240 |
+
$query = new WP_Query($args);
|
241 |
+
|
242 |
+
global $post;
|
243 |
+
$post_count = $query->post_count;
|
244 |
+
$count = 0;
|
245 |
+
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
|
246 |
+
|
247 |
+
$count++;
|
248 |
+
$terms = get_the_terms( $post->ID, 'news-category' );
|
249 |
+
$news_links = array();
|
250 |
+
|
251 |
+
if($terms) {
|
252 |
+
foreach ( $terms as $term ) {
|
253 |
+
$term_link = get_term_link( $term );
|
254 |
+
$news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
$cate_name = join( ", ", $news_links );
|
259 |
+
$css_class="team";
|
260 |
+
|
261 |
+
if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == ($count - 1) % $grid ) ) || 1 == $count ) { $css_class .= ' first'; }
|
262 |
+
if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == $count % $grid ) ) || $post_count == $count ) { $css_class .= ' last'; }
|
263 |
+
if($showDate == 'true'){ $date_class = "has-date";}else{$date_class = "has-no-date";} ?>
|
264 |
+
|
265 |
+
<div id="post-<?php the_ID(); ?>" class="news type-news news-col-<?php echo $gridcol.' '.$css_class.' '.$date_class; ?>">
|
266 |
|
267 |
+
<div class="news-thumb">
|
268 |
+
|
269 |
+
<?php if ( has_post_thumbnail()) {
|
270 |
+
|
271 |
+
if($gridcol == '1'){ ?>
|
272 |
+
|
273 |
+
<div class="grid-news-thumb">
|
274 |
+
|
275 |
+
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('url'); ?></a>
|
276 |
+
</div>
|
277 |
+
<?php } else if($gridcol > '2') { ?>
|
278 |
+
|
279 |
+
<div class="grid-news-thumb">
|
280 |
+
|
281 |
+
<a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('large'); ?></a>
|
282 |
+
</div>
|
283 |
+
<?php } else { ?>
|
284 |
+
|
285 |
+
<div class="grid-news-thumb">
|
286 |
+
|
287 |
+
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large'); ?></a>
|
288 |
+
</div>
|
289 |
+
<?php }
|
290 |
+
} ?>
|
291 |
+
</div>
|
292 |
+
|
293 |
+
<div class="news-content">
|
294 |
+
|
295 |
+
<?php if($gridcol == '1') {
|
296 |
+
|
297 |
+
if($showDate == 'true'){ ?>
|
298 |
+
|
299 |
+
<div class="date-post">
|
300 |
+
|
301 |
+
<h2><span><?php echo get_the_date('j'); ?></span></h2>
|
302 |
+
|
303 |
+
<p><?php echo get_the_date('M y'); ?></p>
|
304 |
+
</div>
|
305 |
+
<?php }?>
|
306 |
+
<?php } else { ?>
|
307 |
+
|
308 |
+
<div class="grid-date-post">
|
309 |
+
|
310 |
+
<?php echo ($showDate == "true")? get_the_date() : "" ;?>
|
311 |
+
|
312 |
<?php echo ($showDate == "true" && $showCategory == "true" && $cate_name != '') ? " / " : "";?>
|
313 |
+
|
314 |
<?php echo ($showCategory == 'true' && $cate_name != '') ? $cate_name : ""?>
|
315 |
+
</div>
|
316 |
+
<?php } ?>
|
317 |
+
|
318 |
+
<div class="post-content-text">
|
319 |
+
|
320 |
+
<?php the_title( sprintf( '<h3 class="news-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' ); ?>
|
321 |
+
|
322 |
+
<?php if($showCategory == 'true' && $gridcol == '1'){ ?>
|
323 |
+
|
324 |
+
<div class="news-cat">
|
325 |
+
|
326 |
<?php echo $cate_name; ?>
|
327 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
+
<?php if($showContent == 'true'){?>
|
331 |
+
|
332 |
+
<div class="news-content-excerpt">
|
333 |
+
|
334 |
+
<?php if($showFullContent == "false" ) {
|
335 |
+
$excerpt = get_the_content(); ?>
|
336 |
+
|
337 |
+
<div class="news-short-content">
|
338 |
+
|
339 |
+
<?php echo string_limit_newswords( $post->ID, $excerpt, $words_limit, '...'); ?>
|
340 |
+
</div>
|
341 |
+
|
342 |
+
<a href="<?php the_permalink(); ?>" class="news-more-link"><?php _e( 'Read More', 'sp-news-and-widget' ); ?></a>
|
343 |
+
<?php } else {
|
344 |
+
|
345 |
+
the_content();
|
346 |
+
} ?>
|
347 |
+
</div><!-- .entry-content -->
|
348 |
+
<?php }?>
|
349 |
+
</div>
|
350 |
+
</div>
|
351 |
+
</div><!-- #post-## -->
|
352 |
+
<?php endwhile; endif; ?>
|
353 |
+
|
354 |
+
<div class="news_pagination">
|
355 |
+
|
356 |
+
<?php if($pagination_type == 'numeric'){
|
357 |
+
|
358 |
+
echo news_pagination( array( 'paged' => $paged , 'total' => $query->max_num_pages ) );
|
359 |
+
}else{ ?>
|
360 |
+
|
361 |
+
<div class="button-news-p"><?php next_posts_link( ' Next >>', $query->max_num_pages ); ?></div>
|
362 |
+
|
363 |
+
<div class="button-news-n"><?php previous_posts_link( '<< Previous' ); ?> </div>
|
364 |
+
<?php } ?>
|
365 |
+
</div><?php
|
366 |
+
|
367 |
+
wp_reset_query();
|
368 |
|
369 |
+
return ob_get_clean();
|
370 |
}
|
371 |
add_shortcode('sp_news','wpnaw_get_news');
|
372 |
|
435 |
break;
|
436 |
}
|
437 |
return $out;
|
438 |
+
}
|
439 |
|
440 |
+
function news_pagination($args = array()){
|
441 |
+
|
442 |
+
$big = 999999999; // need an unlikely integer
|
443 |
+
|
444 |
+
$paging = apply_filters('news_blog_paging_args', array(
|
445 |
+
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
|
446 |
+
'format' => '?paged=%#%',
|
447 |
+
'current' => max( 1, $args['paged'] ),
|
448 |
+
'total' => $args['total'],
|
449 |
+
'prev_next' => true,
|
450 |
+
'prev_text' => __('« Previous', 'wp-blog-and-widgets'),
|
451 |
+
'next_text' => __('Next »', 'wp-blog-and-widgets'),
|
452 |
+
));
|
453 |
+
|
454 |
+
echo paginate_links($paging);
|
455 |
}
|
456 |
|
457 |
// How it work file, Load admin files
|
widget_function.php
CHANGED
@@ -74,15 +74,22 @@
|
|
74 |
<div class="recent-news-items <?php echo $no_p?>">
|
75 |
<ul>
|
76 |
<?php // setup the query
|
77 |
-
$news_args = array(
|
78 |
'posts_per_page' => $num_items,
|
79 |
-
'post_type'
|
80 |
-
'
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
|
|
86 |
$cust_loop = new WP_Query($news_args);
|
87 |
global $post;
|
88 |
$post_count = $cust_loop->post_count;
|
@@ -222,13 +229,20 @@ class SP_News_scrolling_Widget extends WP_Widget {
|
|
222 |
<div class="newsticker-jcarousellite">
|
223 |
<ul>
|
224 |
<?php // setup the query
|
225 |
-
$news_args = array(
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
229 |
);
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
}
|
233 |
$cust_loop = new WP_Query($news_args);
|
234 |
global $post;
|
@@ -365,13 +379,20 @@ class SP_News_thmb_Widget extends WP_Widget {
|
|
365 |
|
366 |
<ul>
|
367 |
<?php // setup the query
|
368 |
-
$news_args = array(
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
}
|
376 |
|
377 |
$cust_loop = new WP_Query($news_args);
|
74 |
<div class="recent-news-items <?php echo $no_p?>">
|
75 |
<ul>
|
76 |
<?php // setup the query
|
77 |
+
$news_args = array(
|
78 |
'posts_per_page' => $num_items,
|
79 |
+
'post_type' => 'news',
|
80 |
+
'post_status' => array( 'publish' ),
|
81 |
+
'order' => 'DESC'
|
82 |
+
);
|
83 |
+
|
84 |
+
if( $category != 0 ) {
|
85 |
+
$news_args['tax_query'] = array(
|
86 |
+
array(
|
87 |
+
'taxonomy' => 'news-category',
|
88 |
+
'field' => 'term_id',
|
89 |
+
'terms' => $category
|
90 |
+
));
|
91 |
}
|
92 |
+
|
93 |
$cust_loop = new WP_Query($news_args);
|
94 |
global $post;
|
95 |
$post_count = $cust_loop->post_count;
|
229 |
<div class="newsticker-jcarousellite">
|
230 |
<ul>
|
231 |
<?php // setup the query
|
232 |
+
$news_args = array(
|
233 |
+
'posts_per_page' => $num_items,
|
234 |
+
'post_type' => 'news',
|
235 |
+
'post_status' => array( 'publish' ),
|
236 |
+
'order' => 'DESC'
|
237 |
);
|
238 |
+
|
239 |
+
if( $category != 0 ) {
|
240 |
+
$news_args['tax_query'] = array(
|
241 |
+
array(
|
242 |
+
'taxonomy' => 'news-category',
|
243 |
+
'field' => 'term_id',
|
244 |
+
'terms' => $category
|
245 |
+
));
|
246 |
}
|
247 |
$cust_loop = new WP_Query($news_args);
|
248 |
global $post;
|
379 |
|
380 |
<ul>
|
381 |
<?php // setup the query
|
382 |
+
$news_args = array(
|
383 |
+
'posts_per_page' => $num_items,
|
384 |
+
'post_type' => 'news',
|
385 |
+
'post_status' => array( 'publish' ),
|
386 |
+
'order' => 'DESC'
|
387 |
+
);
|
388 |
+
|
389 |
+
if($category != 0) {
|
390 |
+
$news_args['tax_query'] = array(
|
391 |
+
array(
|
392 |
+
'taxonomy' => 'news-category',
|
393 |
+
'field' => 'term_id',
|
394 |
+
'terms' => $category
|
395 |
+
));
|
396 |
}
|
397 |
|
398 |
$cust_loop = new WP_Query($news_args);
|