WP News and Scrolling Widgets - Version 3.2.2

Version Description

  • Added Pro version
  • Fixed some bugs
Download this release

Release Info

Developer anoopranawat
Plugin Icon 128x128 WP News and Scrolling Widgets
Version 3.2.2
Comparing to
See all releases

Code changes from version 3.2 to 3.2.2

css/stylenews.css CHANGED
@@ -1,7 +1,6 @@
1
  .news-col-3, .news-col-4, .news-col-2{-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
2
  -moz-box-sizing: border-box; /* Firefox, other Gecko */
3
  box-sizing: border-box; }
4
-
5
  .news{margin-bottom:40px !important; clear:both;}
6
  .news-col-1{padding-bottom:40px; border-bottom:1px solid #d1d1d1;}
7
  .news .news-title{margin-top:0px; margin-bottom:10px !important;}
@@ -13,36 +12,40 @@ box-sizing: border-box; }
13
  .date-post p{margin: 0px;text-transform: uppercase;color: #333; text-align:center !important}
14
  .post-content-text{width:87%; margin-left:2%; float:left;}
15
  .news-thumb{float:left; width:100%; margin-bottom:25px;}
16
- .news-thumb img{width:100%; height:auto; margin:0px !important;}
17
 
 
 
18
  .news_thumb_left{width:80px; float:left;}
19
- .news_thumb_left img{width:100%;}
20
  .news_thumb_right{margin-left:85px;}
21
-
22
  .news_pagination{clear:both; padding:20px 0; float:left; width:100%}
23
- .button-news-p{width:49%; float:left; text-align:left}
24
- .button-news-n{width:49%; float:right; text-align:right}
25
-
26
  .recent-news-items{clear:both;}
27
- .recent-news-items.no_p h6{margin:5px 0;}
28
  .recent-news-items p{font-size:13px !important; margin-bottom:10px !important}
29
-
30
  .news-col-4{width:25%; float:left; clear:none !important; padding:0 15px;}
31
  .news-col-3{width:33%; float:left; clear:none !important; padding:0 15px;}
32
  .news-col-2{width:50%; float:left; clear:none !important; padding:0 15px;}
33
  .news-col-1{width:100%; float:left;}
34
 
35
- .grid-news-thumb{float: left; height: 160px;line-height: 0; overflow: hidden; position: relative; width: 100%;}
36
- .grid-news-thumb img{margin: 0 auto;opacity: 1;position: absolute; }
37
- .news_li h6{clear: none !important; }
38
 
 
 
 
 
 
 
 
39
  .news-col-3 .news-thumb, .news-col-2 .news-thumb, .news-col-4 .news-thumb{margin-bottom:5px;}
40
- .news-col-3 .post-content-text, .news-col-2 .post-content-text, .news-col-4 .post-content-text{width:100%; margin:0px;}p.news-short-content{margin-bottom:5px !important}
41
- .first.last {clear: both !important;}
42
- .first{clear: both !important;}
 
43
  @media all and (max-width: 768px) {
44
  .news-col-3, .news-col-2, .news-col-4{width:100%;}
45
-
46
  }
47
 
48
 
1
  .news-col-3, .news-col-4, .news-col-2{-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
2
  -moz-box-sizing: border-box; /* Firefox, other Gecko */
3
  box-sizing: border-box; }
 
4
  .news{margin-bottom:40px !important; clear:both;}
5
  .news-col-1{padding-bottom:40px; border-bottom:1px solid #d1d1d1;}
6
  .news .news-title{margin-top:0px; margin-bottom:10px !important;}
12
  .date-post p{margin: 0px;text-transform: uppercase;color: #333; text-align:center !important}
13
  .post-content-text{width:87%; margin-left:2%; float:left;}
14
  .news-thumb{float:left; width:100%; margin-bottom:25px;}
15
+ /*.news-thumb img{width:100%; height:auto; margin:0px !important;}*/
16
 
17
+ .news_li{border-bottom:1px solid #ddd; margin:0 !important; list-style:none !important}
18
+ .newstickerthumb .news_li{float:left; width:100%;}
19
  .news_thumb_left{width:80px; float:left;}
20
+ .news_thumb_left img{width:100%; margin:8px 0;}
21
  .news_thumb_right{margin-left:85px;}
 
22
  .news_pagination{clear:both; padding:20px 0; float:left; width:100%}
23
+ .button-news-p{width:49%; float:right; text-align:right}
24
+ .button-news-n{width:49%; float:left; text-align:left}
 
25
  .recent-news-items{clear:both;}
26
+ .recent-news-items.no_p h6{margin:5px 0 !important;}
27
  .recent-news-items p{font-size:13px !important; margin-bottom:10px !important}
 
28
  .news-col-4{width:25%; float:left; clear:none !important; padding:0 15px;}
29
  .news-col-3{width:33%; float:left; clear:none !important; padding:0 15px;}
30
  .news-col-2{width:50%; float:left; clear:none !important; padding:0 15px;}
31
  .news-col-1{width:100%; float:left;}
32
 
33
+ .news-col-1 .news-thumb img{width:100%; height:auto;}
 
 
34
 
35
+ .grid-news-thumb{float: left; height: 170px;line-height: 0; overflow: hidden; position: relative; width: 100%;background: #f1f1f1; }
36
+ .grid-news-thumb img{transition: all 0.2s ease-in-out 0s; left: -9999px; margin: 0 auto;
37
+ opacity: 1; position: absolute; right: -9999px; width:auto !important; max-width:600px !important; }
38
+ .news-col-2 .grid-news-thumb img{ max-width:600px !important; width:auto !important}
39
+ .news_li h6{clear: none !important; margin-bottom:5px !important; margin-top:8px !important; padding-bottom:0px !important; }
40
+ .news_li h6 a.post-title{font-size:auto !important; font-size:16px !important;}
41
+ .news_li p{padding-bottom:0px !important}
42
  .news-col-3 .news-thumb, .news-col-2 .news-thumb, .news-col-4 .news-thumb{margin-bottom:5px;}
43
+ .news-col-3 .post-content-text, .news-col-2 .post-content-text, .news-col-4 .post-content-text{width:100%; margin:0px;}p.news-short-content{margin-bottom:5px !important}.first.last {clear: both !important;}
44
+ .news.first{clear: both !important;}
45
+
46
+ .news-col-1.has-no-date .post-content-text{margin-left:0px; width:100%;}
47
  @media all and (max-width: 768px) {
48
  .news-col-3, .news-col-2, .news-col-4{width:100%;}
 
49
  }
50
 
51
 
js/jcarousellite.js CHANGED
@@ -1,8 +1,8 @@
1
- /*!
2
- * jCarouselLite - v1.1 - 2014-09-28
3
- * http://www.gmarwaha.com/jquery/jcarousellite/
4
- * Copyright (c) 2014 Ganeshji Marwaha
5
- * Licensed MIT (https://github.com/ganeshmax/jcarousellite/blob/master/LICENSE)
6
- */
7
-
8
- !function(a){a.jCarouselLite={version:"1.1"},a.fn.jCarouselLite=function(b){return b=a.extend({},a.fn.jCarouselLite.options,b||{}),this.each(function(){function c(a){return n||(clearTimeout(A),z=a,b.beforeStart&&b.beforeStart.call(this,i()),b.circular?j(a):k(a),m({start:function(){n=!0},done:function(){b.afterEnd&&b.afterEnd.call(this,i()),b.auto&&h(),n=!1}}),b.circular||l()),!1}function d(){if(n=!1,o=b.vertical?"top":"left",p=b.vertical?"height":"width",q=B.find(">ul"),r=q.find(">li"),x=r.size(),w=x<b.visible?x:b.visible,b.circular){var c=r.slice(x-w).clone(),d=r.slice(0,w).clone();q.prepend(c).append(d),b.start+=w}s=a("li",q),y=s.size(),z=b.start}function e(){B.css("visibility","visible"),s.css({overflow:"hidden","float":b.vertical?"none":"left"}),q.css({margin:"0",padding:"0",position:"relative","list-style":"none","z-index":"1"}),B.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"}),!b.circular&&b.btnPrev&&0==b.start&&a(b.btnPrev).addClass("disabled")}function f(){t=b.vertical?s.outerHeight(!0):s.outerWidth(!0),u=t*y,v=t*w,s.css({width:s.width(),height:s.height()}),q.css(p,u+"px").css(o,-(z*t)),B.css(p,v+"px")}function g(){b.btnPrev&&a(b.btnPrev).click(function(){return c(z-b.scroll)}),b.btnNext&&a(b.btnNext).click(function(){return c(z+b.scroll)}),b.btnGo&&a.each(b.btnGo,function(d,e){a(e).click(function(){return c(b.circular?w+d:d)})}),b.mouseWheel&&B.mousewheel&&B.mousewheel(function(a,d){return c(d>0?z-b.scroll:z+b.scroll)}),b.auto&&h()}function h(){A=setTimeout(function(){c(z+b.scroll)},b.auto)}function i(){return s.slice(z).slice(0,w)}function j(a){var c;a<=b.start-w-1?(c=a+x+b.scroll,q.css(o,-(c*t)+"px"),z=c-b.scroll):a>=y-w+1&&(c=a-x-b.scroll,q.css(o,-(c*t)+"px"),z=c+b.scroll)}function k(a){0>a?z=0:a>y-w&&(z=y-w)}function l(){a(b.btnPrev+","+b.btnNext).removeClass("disabled"),a(z-b.scroll<0&&b.btnPrev||z+b.scroll>y-w&&b.btnNext||[]).addClass("disabled")}function m(c){n=!0,q.animate("left"==o?{left:-(z*t)}:{top:-(z*t)},a.extend({duration:b.speed,easing:b.easing},c))}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=a(this);d(),e(),f(),g()})},a.fn.jCarouselLite.options={btnPrev:null,btnNext:null,btnGo:null,mouseWheel:!1,auto:null,speed:200,easing:null,vertical:!1,circular:!0,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null}}(jQuery);
1
+ /*!
2
+ * jCarouselLite - v1.1 - 2014-09-28
3
+ * http://www.gmarwaha.com/jquery/jcarousellite/
4
+ * Copyright (c) 2014 Ganeshji Marwaha
5
+ * Licensed MIT (https://github.com/ganeshmax/jcarousellite/blob/master/LICENSE)
6
+ */
7
+
8
+ !function(a){a.jCarouselLite={version:"1.1"},a.fn.jCarouselLite=function(b){return b=a.extend({},a.fn.jCarouselLite.options,b||{}),this.each(function(){function c(a){return n||(clearTimeout(A),z=a,b.beforeStart&&b.beforeStart.call(this,i()),b.circular?j(a):k(a),m({start:function(){n=!0},done:function(){b.afterEnd&&b.afterEnd.call(this,i()),b.auto&&h(),n=!1}}),b.circular||l()),!1}function d(){if(n=!1,o=b.vertical?"top":"left",p=b.vertical?"height":"width",q=B.find(">ul"),r=q.find(">li"),x=r.size(),w=x<b.visible?x:b.visible,b.circular){var c=r.slice(x-w).clone(),d=r.slice(0,w).clone();q.prepend(c).append(d),b.start+=w}s=a("li",q),y=s.size(),z=b.start}function e(){B.css("visibility","visible"),s.css({overflow:"hidden","float":b.vertical?"none":"left"}),q.css({margin:"0",padding:"0",position:"relative","list-style":"none","z-index":"1"}),B.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"}),!b.circular&&b.btnPrev&&0==b.start&&a(b.btnPrev).addClass("disabled")}function f(){t=b.vertical?s.outerHeight(!0):s.outerWidth(!0),u=t*y,v=t*w,s.css({width:s.width(),height:s.height()}),q.css(p,u+"px").css(o,-(z*t)),B.css(p,v+"px")}function g(){b.btnPrev&&a(b.btnPrev).click(function(){return c(z-b.scroll)}),b.btnNext&&a(b.btnNext).click(function(){return c(z+b.scroll)}),b.btnGo&&a.each(b.btnGo,function(d,e){a(e).click(function(){return c(b.circular?w+d:d)})}),b.mouseWheel&&B.mousewheel&&B.mousewheel(function(a,d){return c(d>0?z-b.scroll:z+b.scroll)}),b.auto&&h()}function h(){A=setTimeout(function(){c(z+b.scroll)},b.auto)}function i(){return s.slice(z).slice(0,w)}function j(a){var c;a<=b.start-w-1?(c=a+x+b.scroll,q.css(o,-(c*t)+"px"),z=c-b.scroll):a>=y-w+1&&(c=a-x-b.scroll,q.css(o,-(c*t)+"px"),z=c+b.scroll)}function k(a){0>a?z=0:a>y-w&&(z=y-w)}function l(){a(b.btnPrev+","+b.btnNext).removeClass("disabled"),a(z-b.scroll<0&&b.btnPrev||z+b.scroll>y-w&&b.btnNext||[]).addClass("disabled")}function m(c){n=!0,q.animate("left"==o?{left:-(z*t)}:{top:-(z*t)},a.extend({duration:b.speed,easing:b.easing},c))}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=a(this);d(),e(),f(),g()})},a.fn.jCarouselLite.options={btnPrev:null,btnNext:null,btnGo:null,mouseWheel:!1,auto:null,speed:200,easing:null,vertical:!1,circular:!0,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null}}(jQuery);
news_menu_function.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action('admin_menu', 'free_register_newsdesigns_submenu_page');
4
+
5
+ function free_register_newsdesigns_submenu_page() {
6
+ add_submenu_page( 'edit.php?post_type=news', 'Pro News Designs', 'Pro News Designs', 'manage_options', 'newsdesigns-submenu-page', 'free_newsdesigns_page_callback' );
7
+ }
8
+
9
+ function free_newsdesigns_page_callback() {
10
+
11
+ $result ='<div class="wrap"><div id="icon-tools" class="icon32"></div><h2 style="padding:15px 0">Pro News Designs</h2></div>
12
+ <a href="http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/" target="_blank"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/News_banner.png"></a>
13
+ <div class="medium-12 columns"><h3>News Slider/Carousel</h3>
14
+ <p><b>Complete shortcode is:</b><br /><code>[sp_news_slider design="design-1" slides_column="1" slides_scroll="1" dots="true" arrows="true" autoplay="true" autoplay_interval="3000" speed="300"
15
+ loop="true" limit="5" category="5" category_name="Sports" show_read_more="false" show_date="true" show_category_name="true" show_content="true" content_words_limit="20"]</code></div>
16
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-1.jpg"><p><code>[sp_news_slider design="design-1" slides_column="1"]</code></p></div></div>
17
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-2.jpg"><p><code>[sp_news_slider design="design-2" slides_column="1"]</code></p></div></div>
18
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-3.jpg"><p><code>[sp_news_slider design="design-3" slides_column="1"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
19
+ <div class="medium-3 columns" ><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-4.jpg"><p><code>[sp_news_slider design="design-4" slides_column="1"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
20
+ <div class="medium-3 columns" style="clear:both"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-5.jpg"><p><code>[sp_news_slider design="design-5" slides_column="1"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
21
+ <div class="medium-3 columns" ><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-7.jpg"><p><code>[sp_news_slider design="design-7" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</p></div></div>
22
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-8.jpg"><p><code>[sp_news_slider design="design-8" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
23
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-9.jpg"><p><code>[sp_news_slider design="design-9" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
24
+ <div class="medium-3 columns" style="clear:both"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-10.jpg"><p><code>[sp_news_slider design="design-10" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
25
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-11.jpg"><p><code>[sp_news_slider design="design-11" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
26
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-12.jpg"><p><code>[sp_news_slider design="design-12" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
27
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-13.jpg"><p><code>[sp_news_slider design="design-13" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
28
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-14.jpg"><p><code>[sp_news_slider design="design-14" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
29
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-15.jpg"><p><code>[sp_news_slider design="design-15" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
30
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-32.jpg"><p><code>[sp_news_slider design="design-32" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
31
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-33.jpg"><p><code>[sp_news_slider design="design-33" slides_column="3"]</code></p>Where slides_column is 1,2,3,4 etc</div></div>
32
+
33
+ <div class="medium-12 columns"><h3>News Grid View and Block View</h3>
34
+ <a href="http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/" target="_blank"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/News_banner.png"></a>
35
+ <p><b>Complete shortcode is:</b><br /><code>[sp_news design="design-16" limit="5" grid="2" category="5" category_name="Sports" pagination="true" show_date="true"
36
+ show_category_name="true" show_content="true" show_full_content="true" content_words_limit="20" show_read_more="false"]</code></div>
37
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-16.jpg"><p><code>[sp_news design="design-16" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
38
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-17.jpg"><p><code>[sp_news design="design-17" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
39
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-18.jpg"><p><code>[sp_news design="design-18" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
40
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-19.jpg"><p><code>[sp_news design="design-19" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
41
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-20.jpg"><p><code>[sp_news design="design-20" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
42
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-21.jpg"><p><code>[sp_news design="design-21" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
43
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-22.jpg"><p><code>[sp_news design="design-22" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
44
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-23.jpg"><p><code>[sp_news design="design-23" limit="3" pagination="false"]</code></p>Use same paramater as given</div></div>
45
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-24.jpg"><p><code>[sp_news design="design-24"]</code></p>Only List View</div></div>
46
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-25.jpg"><p><code>[sp_news design="design-25" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
47
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-26.jpg"><p><code>[sp_news design="design-26"]</code></p>Only List View</div></div>
48
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-27.jpg"><p><code>[sp_news design="design-27"]</code></p>Only List View</div></div>
49
+ <div class="medium-3 columns" style="clear:both"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-28.jpg"><p><code>[sp_news design="design-28" limit="4" pagination="false"]</code></p>Use same paramater as given</div></div>
50
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-29.jpg"><p><code>[sp_news design="design-29" limit="4" pagination="false"]</code></p>Use same paramater as given</div></div>
51
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-31.jpg"><p><code>[sp_news design="design-31" limit="4" pagination="false"]</code></p>Use same paramater as given</div></div>
52
+ <div class="medium-3 columns"><div class="postdesigns"><img src="'.plugin_dir_url( __FILE__ ).'pro-designs/news-design-34.jpg"><p><code>[sp_news design="design-34" grid="2"]</code></p>Where grid is 1,2,3,4 etc</div></div>
53
+ <div class="medium-12 columns"><h2>Check the demo</h2>
54
+ <p><strong>Check Demo Link</strong> <a href="http://demo.wponlinesupport.com/prodemo/news-plugin-pro/" target="_blank">Pro WP News and Widget Plugin</a></div></div>';
55
+
56
+ echo $result;
57
+ }
58
+ function free_newsdesign_admin_style(){
59
+ ?>
60
+ <style type="text/css">
61
+ .postdesigns{-moz-box-shadow: 0 0 5px #ddd;-webkit-box-shadow: 0 0 5px#ddd;box-shadow: 0 0 5px #ddd; background:#fff; padding:10px; margin-bottom:15px;}
62
+ .column, .columns {-webkit-box-sizing: border-box;-moz-box-sizing: border-box; box-sizing: border-box;}
63
+ .postdesigns img{width:100%; height:auto;}
64
+ @media only screen and (min-width: 40.0625em) {
65
+ .column,
66
+ .columns {position: relative;padding-left:10px;padding-right:10px;float: left; }
67
+ .medium-1 { width: 8.33333%; }
68
+ .medium-2 { width: 16.66667%; }
69
+ .medium-3 { width: 25%; }
70
+ .medium-4 { width: 33.33333%; }
71
+ .medium-5 { width: 41.66667%; }
72
+ .medium-6 { width: 50%; }
73
+ .medium-7 { width: 58.33333%; }
74
+ .medium-8 { width: 66.66667%; }
75
+ .medium-9 { width: 75%; }
76
+ .medium-10 { width: 83.33333%; }
77
+ .medium-11 { width: 91.66667%; }
78
+ .medium-12 { width: 100%; }
79
+
80
+ }
81
+ </style>
82
+ <?php }
83
+
84
+ add_action('admin_head', 'free_newsdesign_admin_style');
pro-designs/News_banner.png ADDED
Binary file
pro-designs/news-design-1.jpg ADDED
Binary file
pro-designs/news-design-10.jpg ADDED
Binary file
pro-designs/news-design-11.jpg ADDED
Binary file
pro-designs/news-design-12.jpg ADDED
Binary file
pro-designs/news-design-13.jpg ADDED
Binary file
pro-designs/news-design-14.jpg ADDED
Binary file
pro-designs/news-design-15.jpg ADDED
Binary file
pro-designs/news-design-16.jpg ADDED
Binary file
pro-designs/news-design-17.jpg ADDED
Binary file
pro-designs/news-design-18.jpg ADDED
Binary file
pro-designs/news-design-19.jpg ADDED
Binary file
pro-designs/news-design-2.jpg ADDED
Binary file
pro-designs/news-design-20.jpg ADDED
Binary file
pro-designs/news-design-21.jpg ADDED
Binary file
pro-designs/news-design-22.jpg ADDED
Binary file
pro-designs/news-design-23.jpg ADDED
Binary file
pro-designs/news-design-24.jpg ADDED
Binary file
pro-designs/news-design-25.jpg ADDED
Binary file
pro-designs/news-design-26.jpg ADDED
Binary file
pro-designs/news-design-27.jpg ADDED
Binary file
pro-designs/news-design-28.jpg ADDED
Binary file
pro-designs/news-design-29.jpg ADDED
Binary file
pro-designs/news-design-3.jpg ADDED
Binary file
pro-designs/news-design-31.jpg ADDED
Binary file
pro-designs/news-design-32.jpg ADDED
Binary file
pro-designs/news-design-33.jpg ADDED
Binary file
pro-designs/news-design-34.jpg ADDED
Binary file
pro-designs/news-design-4.jpg ADDED
Binary file
pro-designs/news-design-5.jpg ADDED
Binary file
pro-designs/news-design-7.jpg ADDED
Binary file
pro-designs/news-design-8.jpg ADDED
Binary file
pro-designs/news-design-9.jpg ADDED
Binary file
readme.txt CHANGED
@@ -2,25 +2,26 @@
2
  Contributors: wponlinesupport, anoopranawat
3
  Tags: wordpress news plugin, 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.3
6
  Author URI: http://wponlinesupport.com
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- A quick, easy way to add an News custom post type, News widget, vertical and horizontal scrolling news widget to Wordpress.
12
 
13
  == Description ==
14
 
15
- Every CMS site needs a news section. SP News allows you add, manage and display news, date archives, widget, vertical and horizontal news scrolling widget on your website.
16
 
17
- View [DEMO](http://demo.wponlinesupport.com/sp-news/) for additional information.
 
 
18
 
19
  View [screenshots](http://wordpress.org/plugins/sp-news-and-widget/screenshots/) for additional information.
20
 
21
  = Installation help and support =
22
- * Please check [installation help](http://wponlinesupport.com/plugin-installation-support/) on our website. View [Installation help and support](http://wponlinesupport.com/plugin-installation-support/)
23
- * Get [Free installation and setup](http://wponlinesupport.com/plugin-installation-support/) on your website.
24
 
25
  = Important Note For How to Install =
26
  * Please make sure that Permalink link should not be "/news" Otherwise all your news will go to archive page. You can give it other name like "/ournews, /latestnews etc"
@@ -39,20 +40,22 @@ Arts news
39
  </code>
40
 
41
  * **Complete shortcode example:**
42
- <code>[sp_news limit="10" category="category_id" grid="2" show_content="true" show_category_name="true" content_words_limit="30" ]</code>
 
 
43
 
44
  * Comments for the news
45
 
46
  * Added Widget Options like Show News date, Show News Categories, Select News Categories.
47
 
48
- * Users that are using version 2.1 please paste the shortcode in their News page <code> [sp_news] </code> and If your Permalink link is www.yourdoamin.com/news then plaese change from "news" to other name like "ournews", "latestnews etc" otherwise all your news will go to archive page.
49
-
50
  = Following are News Parameters: =
51
 
52
  * **limit :** [sp_news limit="10"] (Display latest 10 news and then pagination).
53
  * **category :** [sp_news category="category_id"] (Display News categories wise).
54
  * **grid :** [sp_news grid="2"] (Display News in Grid formats).
 
55
  * **show_content :** [sp_news show_content="true" ] (Display News Short content OR not. By default value is "True". Options are "ture OR false").
 
56
  * **show_category_name :** [sp_news show_category_name="true" ] (Display News category name OR not. By default value is "True". Options are "ture OR false").
57
  * **content_words_limit :** [sp_news content_words_limit="30" ] (Control News short content Words limt. By default limit is 20 words).
58
 
@@ -64,7 +67,6 @@ The plugin adds a News tab to your admin menu, which allows you to enter news it
64
  If you are getting any kind of problum with news page means your are not able to see all news items then please remodify your permalinks Structure for example
65
  first select "Default" and save then again select "Custom Structure " and save.
66
 
67
- Finally, the plugin adds a Recent News Items widget and vertical news scrolling widget , which can be placed on any sidebar available in your theme. You can set the title of this list and the number of news items to show.
68
 
69
  = Added New Features : =
70
  * Added Widget Options like Show News date, Show News Categories, Select News Categories.
@@ -73,7 +75,20 @@ Finally, the plugin adds a Recent News Items widget and vertical news scrolling
73
  * Display News with Grid [sp_news grid="2"]
74
  * Added pagination [sp_news limit="10"]
75
  * Added new shortcode parameters ie show_content, show_category_name and content_words_limit
 
 
 
 
 
 
 
 
 
 
 
 
76
 
 
77
 
78
  = Features include: =
79
  * Just create a news page with any name and add the shortcode <code> [sp_news] </code>
@@ -129,6 +144,16 @@ Yse <code> [sp_news] </code>.
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
 
 
 
 
132
  = 3.2 =
133
 
134
  * Widget Options like Show News date, Show News Categories, Select News Categories.
@@ -175,6 +200,17 @@ Yse <code> [sp_news] </code>.
175
 
176
  == Upgrade Notice ==
177
 
 
 
 
 
 
 
 
 
 
 
 
178
  = 3.2 =
179
 
180
  * Widget Options like Show News date, Show News Categories, Select News Categories.
2
  Contributors: wponlinesupport, anoopranawat
3
  Tags: wordpress news plugin, 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.4
6
  Author URI: http://wponlinesupport.com
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ A quick, easy way to add an News custom post type, News widget, vertical scrolling news widget to Wordpress.
12
 
13
  == Description ==
14
 
15
+ Every CMS site needs a news section. SP News allows you add, manage and display news, date archives, widget, vertical and horizontal news scrolling widget on your website.
16
 
17
+ View [DEMO](http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/) for additional information.
18
+
19
+ View [PRO DEMO and Features](http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/) for additional information.
20
 
21
  View [screenshots](http://wordpress.org/plugins/sp-news-and-widget/screenshots/) for additional information.
22
 
23
  = Installation help and support =
24
+ * Please check [Installation and Document ](http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/) on our website.
 
25
 
26
  = Important Note For How to Install =
27
  * Please make sure that Permalink link should not be "/news" Otherwise all your news will go to archive page. You can give it other name like "/ournews, /latestnews etc"
40
  </code>
41
 
42
  * **Complete shortcode example:**
43
+ <code>[sp_news limit="10" category="category_id" grid="2"
44
+ show_content="true" show_full_content="true" show_category_name="true"
45
+ show_date="false" content_words_limit="30" ]</code>
46
 
47
  * Comments for the news
48
 
49
  * Added Widget Options like Show News date, Show News Categories, Select News Categories.
50
 
 
 
51
  = Following are News Parameters: =
52
 
53
  * **limit :** [sp_news limit="10"] (Display latest 10 news and then pagination).
54
  * **category :** [sp_news category="category_id"] (Display News categories wise).
55
  * **grid :** [sp_news grid="2"] (Display News in Grid formats).
56
+ * **show_date :** [sp_news show_date="false"] (Display News date OR not. By default value is "True". Options are "ture OR false")
57
  * **show_content :** [sp_news show_content="true" ] (Display News Short content OR not. By default value is "True". Options are "ture OR false").
58
+ * **show_full_content :** [sp_news show_full_content="true"] (Display Full news content on main page if you do not want word limit. By default value is "false")
59
  * **show_category_name :** [sp_news show_category_name="true" ] (Display News category name OR not. By default value is "True". Options are "ture OR false").
60
  * **content_words_limit :** [sp_news content_words_limit="30" ] (Control News short content Words limt. By default limit is 20 words).
61
 
67
  If you are getting any kind of problum with news page means your are not able to see all news items then please remodify your permalinks Structure for example
68
  first select "Default" and save then again select "Custom Structure " and save.
69
 
 
70
 
71
  = Added New Features : =
72
  * Added Widget Options like Show News date, Show News Categories, Select News Categories.
75
  * Display News with Grid [sp_news grid="2"]
76
  * Added pagination [sp_news limit="10"]
77
  * Added new shortcode parameters ie show_content, show_category_name and content_words_limit
78
+ * Added new shortcode parameters show_date
79
+
80
+ = PRO Features : =
81
+ * Added 2 shortcodes
82
+ <code>[sp_news] and [sp_news_slider]</code>
83
+ * Recent News Slider
84
+ * Recent News carousel slider
85
+ * Recent News in Grid view
86
+ * 5 Latest News widgets
87
+ * News display with categories
88
+ * Create a News Page OR News website
89
+ * Added 30 layouts and designs
90
 
91
+ View [PRO DEMO and Features](http://wponlinesupport.com/sp_plugin/sp-news-and-scrolling-widgets/) for additional information.
92
 
93
  = Features include: =
94
  * Just create a news page with any name and add the shortcode <code> [sp_news] </code>
144
 
145
  == Changelog ==
146
 
147
+ = 3.2.2 =
148
+
149
+ * Added Pro version
150
+ * Fixed some bugs
151
+
152
+ = 3.2.1 =
153
+
154
+ * Added new shortcode parameters show_date.
155
+ * Fixed some bugs.
156
+
157
  = 3.2 =
158
 
159
  * Widget Options like Show News date, Show News Categories, Select News Categories.
200
 
201
  == Upgrade Notice ==
202
 
203
+ = 3.2.2 =
204
+
205
+ * Added Pro version
206
+ * Fixed some bugs
207
+
208
+ = 3.2.1 =
209
+
210
+ * Added new shortcode parameters show_date.
211
+ * Fixed some bugs.
212
+
213
+
214
  = 3.2 =
215
 
216
  * Widget Options like Show News date, Show News Categories, Select News Categories.
sp-news-and-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: WP News and three widgets(static, scrolling and scrolling with thumbs)
4
  Plugin URL: http://www.wponlinesupport.com/
5
- Description: A simple News and three widgets(static, scrolling and scrolling with thumbs) plugin
6
- Version: 3.2
7
  Author: WP Online Support
8
  Author URI: http://www.wponlinesupport.com/
9
  Contributors: WP Online Support
@@ -12,6 +12,29 @@ Contributors: WP Online Support
12
  * Register CPT sp_News
13
  *
14
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  // Initialization function
16
  add_action('init', 'sp_cpt_news_init');
17
  function sp_cpt_news_init() {
@@ -46,7 +69,7 @@ function sp_cpt_news_init() {
46
  'capability_type' => 'post',
47
  'has_archive' => true,
48
  'hierarchical' => false,
49
- 'menu_position' => 8,
50
  'menu_icon' => 'dashicons-feedback',
51
  'supports' => array('title','editor','thumbnail','excerpt','comments'),
52
  'taxonomies' => array('post_tag')
@@ -67,7 +90,7 @@ function news_taxonomies() {
67
  'update_item' => __( 'Update Category' ),
68
  'add_new_item' => __( 'Add New Category' ),
69
  'new_item_name' => __( 'New Category Name' ),
70
- 'menu_name' => __( 'Category' ),
71
  );
72
 
73
  $args = array(
@@ -92,358 +115,9 @@ add_action( 'wp_enqueue_scripts','style_css_script' );
92
  wp_enqueue_style( 'cssnews', plugin_dir_url( __FILE__ ). 'css/stylenews.css' );
93
  wp_enqueue_script( 'vticker', plugin_dir_url( __FILE__ ) . 'js/jcarousellite.js', array( 'jquery' ));
94
  }
95
- class SP_News_Widget extends WP_Widget {
96
-
97
- function SP_News_Widget() {
98
-
99
- $widget_ops = array('classname' => 'SP_News_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar', 'news_cpt') );
100
- $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_widget' );
101
- $this->WP_Widget( 'sp_news_widget', __('Letest News Widget', 'news_cpt'), $widget_ops, $control_ops );
102
- }
103
-
104
- function form($instance) {
105
- $instance = wp_parse_args((array) $instance, array( 'title' => '' ));
106
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
107
- $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
108
- ?>
109
- <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
110
- <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
111
- <p>
112
- <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
113
- <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
114
- </p>
115
- <p>
116
- <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
117
- <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
118
- </p>
119
- <p>
120
- <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
121
- <?php
122
- $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
123
- wp_dropdown_categories( $dropdown_args );
124
- ?>
125
- </p>
126
- <?php
127
- }
128
-
129
- function update($new_instance, $old_instance) {
130
- $instance = $old_instance;
131
- $instance['title'] = $new_instance['title'];
132
- $instance['num_items'] = $new_instance['num_items'];
133
- $instance['date'] = (bool) esc_attr( $new_instance['date'] );
134
- $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
135
- $instance['category'] = intval( $new_instance['category'] );
136
- return $instance;
137
- }
138
- function widget($news_args, $instance) {
139
- extract($news_args, EXTR_SKIP);
140
-
141
- $current_post_name = get_query_var('name');
142
-
143
- $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
144
- $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
145
- if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
146
- if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
147
- if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
148
- $postcount = 0;
149
-
150
- echo $before_widget;
151
-
152
- ?>
153
- <h4 class="widget-title"><?php echo $title ?></h4>
154
- <!--visual-columns-->
155
- <?php if($date == "false" && $show_category == "false"){
156
- $no_p = "no_p";
157
- }?>
158
- <div class="recent-news-items <?php echo $no_p?>">
159
- <ul>
160
- <?php // setup the query
161
- $news_args = array( 'suppress_filters' => true,
162
- 'posts_per_page' => $num_items,
163
- 'post_type' => 'news',
164
- 'order' => 'DESC'
165
- );
166
-
167
- if($category != 0){
168
- $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
169
- }
170
- $cust_loop = new WP_Query($news_args);
171
- $post_count = $cust_loop->post_count;
172
- $count = 0;
173
-
174
- if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
175
- $count++;
176
- $terms = get_the_terms( $post->ID, 'news-category' );
177
- $news_links = array();
178
- if($terms){
179
-
180
- foreach ( $terms as $term ) {
181
- $term_link = get_term_link( $term );
182
- $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
183
- }
184
- }
185
- $cate_name = join( ", ", $news_links );
186
- ?>
187
- <li class="news_li">
188
- <h6> <a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
189
- <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
190
- <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
191
- <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?>
192
- </li>
193
- <?php endwhile;
194
- endif;
195
- wp_reset_query(); ?>
196
-
197
- </ul>
198
- </div>
199
- <?php
200
- echo $after_widget;
201
- }
202
- }
203
- /* Register the widget */
204
- function sp_news_widget_load_widgets() {
205
- register_widget( 'SP_News_Widget' );
206
- }
207
- /* Load the widget */
208
- add_action( 'widgets_init', 'sp_news_widget_load_widgets' );
209
- /* scrolling news */
210
- class SP_News_scrolling_Widget extends WP_Widget {
211
- function SP_News_scrolling_Widget() {
212
- $widget_ops = array('classname' => 'SP_News_scrolling_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar', 'news_cpt') );
213
- $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_s_widget' );
214
- $this->WP_Widget( 'sp_news_s_widget', __('Letest News Scrolling Widget', 'news_cpt'), $widget_ops, $control_ops );
215
- }
216
- function form($instance) {
217
- $instance = wp_parse_args((array) $instance, array( 'title' => '' ));
218
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
219
- $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
220
- ?>
221
- <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
222
- <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
223
- <p>
224
- <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
225
- <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
226
- </p>
227
- <p>
228
- <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
229
- <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
230
- </p>
231
- <p>
232
- <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
233
- <?php
234
- $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
235
- wp_dropdown_categories( $dropdown_args );
236
- ?>
237
- </p>
238
- <?php
239
- }
240
-
241
- function update($new_instance, $old_instance) {
242
- $instance = $old_instance;
243
- $instance['title'] = $new_instance['title'];
244
- $instance['num_items'] = $new_instance['num_items'];
245
- $instance['date'] = (bool) esc_attr( $new_instance['date'] );
246
- $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
247
- $instance['category'] = intval( $new_instance['category'] );
248
- return $instance;
249
- }
250
- function widget($news_args, $instance) {
251
- extract($news_args, EXTR_SKIP);
252
- $current_post_name = get_query_var('name');
253
- $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
254
- $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
255
- if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
256
- if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
257
- if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
258
- $postcount = 0;
259
-
260
- echo $before_widget;
261
-
262
- ?>
263
- <h4 class="widget-title"><?php echo $title ?></h4>
264
- <!--visual-columns-->
265
- <?php if($date == "false" && $show_category == "false"){
266
- $no_p = "no_p";
267
- }?>
268
- <div class="recent-news-items <?php echo $no_p;?>">
269
- <div class="newsticker-jcarousellite">
270
- <ul>
271
- <?php // setup the query
272
- $news_args = array( 'suppress_filters' => true,
273
- 'posts_per_page' => $num_items,
274
- 'post_type' => 'news',
275
- 'order' => 'DESC'
276
- );
277
- if($category != 0){
278
- $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
279
- }
280
- $cust_loop = new WP_Query($news_args);
281
- $post_count = $cust_loop->post_count;
282
- $count = 0;
283
-
284
- if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
285
- $count++;
286
- $terms = get_the_terms( $post->ID, 'news-category' );
287
- $news_links = array();
288
- if($terms){
289
-
290
- foreach ( $terms as $term ) {
291
- $term_link = get_term_link( $term );
292
- $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
293
- }
294
- }
295
- $cate_name = join( ", ", $news_links );
296
- ?>
297
- <li class="news_li">
298
- <h6><a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
299
- <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
300
- <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
301
- <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?>
302
- </li>
303
- <?php endwhile;
304
- endif;
305
- wp_reset_query(); ?>
306
- </ul>
307
- </div>
308
- </div>
309
- <?php
310
- echo $after_widget;
311
- }
312
- }
313
-
314
- /* Register the widget */
315
- function sp_news_scroll_widget_load_widgets() {
316
- register_widget( 'SP_News_scrolling_Widget' );
317
- }
318
-
319
- /* Load the widget */
320
- add_action( 'widgets_init', 'sp_news_scroll_widget_load_widgets' );
321
-
322
- /* news with thumb */
323
- class SP_News_thmb_Widget extends WP_Widget {
324
-
325
- function SP_News_thmb_Widget() {
326
-
327
- $widget_ops = array('classname' => 'SP_News_thmb_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar with thumbnails', 'news_cpt') );
328
- $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_sthumb_widget' );
329
- $this->WP_Widget( 'sp_news_sthumb_widget', __('Letest News with thumb Widget', 'news_cpt'), $widget_ops, $control_ops );
330
- }
331
-
332
- function form($instance) {
333
- $instance = wp_parse_args((array) $instance, array( 'title' => '' ));
334
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
335
- $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
336
- ?>
337
- <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
338
- <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
339
- <p>
340
- <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
341
- <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
342
- </p>
343
- <p>
344
- <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
345
- <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
346
- </p>
347
- <p>
348
- <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
349
- <?php
350
- $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
351
- wp_dropdown_categories( $dropdown_args );
352
- ?>
353
- </p>
354
- <?php
355
- }
356
-
357
- function update($new_instance, $old_instance) {
358
- $instance = $old_instance;
359
- $instance['title'] = $new_instance['title'];
360
- $instance['num_items'] = $new_instance['num_items'];
361
- $instance['date'] = (bool) esc_attr( $new_instance['date'] );
362
- $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
363
- $instance['category'] = intval( $new_instance['category'] );
364
- return $instance;
365
- }
366
- function widget($news_args, $instance) {
367
- extract($news_args, EXTR_SKIP);
368
-
369
- $current_post_name = get_query_var('name');
370
-
371
- $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
372
- $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
373
- if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
374
- if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
375
- if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
376
- $postcount = 0;
377
- echo $before_widget;
378
- ?>
379
- <h4 class="widget-title"><?php echo $title ?></h4>
380
- <!--visual-columns-->
381
- <?php if($date == "false" && $show_category == "false"){
382
- $no_p = "no_p";
383
- }?>
384
- <div class="recent-news-items <?php echo $no_p;?>">
385
- <div class="newstickerthumb-jcarousellite">
386
- <ul>
387
- <?php // setup the query
388
- $news_args = array( 'suppress_filters' => true,
389
- 'posts_per_page' => $num_items,
390
- 'post_type' => 'news',
391
- 'order' => 'DESC'
392
- );
393
- if($category != 0){
394
- $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
395
- }
396
-
397
- $cust_loop = new WP_Query($news_args);
398
- $post_count = $cust_loop->post_count;
399
- $count = 0;
400
- if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
401
- $count++;
402
- $terms = get_the_terms( $post->ID, 'news-category' );
403
- $news_links = array();
404
- if($terms){
405
-
406
- foreach ( $terms as $term ) {
407
- $term_link = get_term_link( $term );
408
- $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
409
- }
410
- }
411
- $cate_name = join( ", ", $news_links );
412
- ?>
413
- <li class="news_li">
414
- <div class="news_thumb_left">
415
- <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
416
-
417
- <?php
418
- if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
419
- the_post_thumbnail( array(80,80) );
420
- }
421
- ?> </a></div>
422
- <div class="news_thumb_right">
423
- <h6><a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
424
- <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
425
- <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
426
- <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?></div>
427
-
428
- </li>
429
- <?php endwhile;
430
- endif;
431
- wp_reset_query(); ?>
432
-
433
- </ul>
434
- </div> </div>
435
- <?php
436
- echo $after_widget;
437
- }
438
- }
439
- /* Register the widget */
440
- function sp_news_thumb_widget_load_widgets() {
441
- register_widget( 'SP_News_thmb_Widget' );
442
- }
443
-
444
- /* Load the widget */
445
- add_action( 'widgets_init', 'sp_news_thumb_widget_load_widgets' );
446
 
 
 
447
 
448
  function get_news( $atts, $content = null ){
449
  // setup the query
@@ -451,8 +125,10 @@ function get_news( $atts, $content = null ){
451
  "limit" => '',
452
  "category" => '',
453
  "grid" => '',
 
454
  "show_category_name" => '',
455
  "show_content" => '',
 
456
  "content_words_limit" => '',
457
  ), $atts));
458
  // Define limit
@@ -471,6 +147,11 @@ function get_news( $atts, $content = null ){
471
  } else {
472
  $gridcol = '1';
473
  }
 
 
 
 
 
474
  if( $show_category_name ) {
475
  $showCategory = $show_category_name;
476
  } else {
@@ -480,6 +161,11 @@ function get_news( $atts, $content = null ){
480
  $showContent = $show_content;
481
  } else {
482
  $showContent = 'true';
 
 
 
 
 
483
  }
484
  if( $content_words_limit ) {
485
  $words_limit = $content_words_limit;
@@ -487,7 +173,13 @@ function get_news( $atts, $content = null ){
487
  $words_limit = '20';
488
  }
489
  ob_start();
490
- $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
 
 
 
 
 
 
491
 
492
  $post_type = 'news';
493
  $orderby = 'post_date';
@@ -521,9 +213,10 @@ function get_news( $atts, $content = null ){
521
  $css_class="team";
522
  if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == ($count - 1) % $grid ) ) || 1 == $count ) { $css_class .= ' first'; }
523
  if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == $count % $grid ) ) || $post_count == $count ) { $css_class .= ' last'; }
 
524
  ?>
525
 
526
- <div id="post-<?php the_ID(); ?>" class="news type-news news-col-<?php echo $gridcol.' '.$css_class; ?>">
527
  <div class="news-thumb">
528
  <?php
529
  // Post thumbnail.
@@ -532,26 +225,31 @@ function get_news( $atts, $content = null ){
532
  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('url'); ?></a>
533
  <?php } else if($gridcol > '2') { ?>
534
  <div class="grid-news-thumb">
535
- <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('thumbnail'); ?></a>
536
  </div>
537
  <?php } else { ?>
538
  <div class="grid-news-thumb">
539
- <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium'); ?></a>
540
  </div>
541
  <?php } }?>
542
  </div>
543
  <div class="news-content">
544
- <?php if($gridcol == '1') { ?>
 
545
  <div class="date-post">
546
  <h2><span><?php echo get_the_date('j'); ?></span></h2>
547
  <p><?php echo get_the_date('M y'); ?></p>
548
-
549
  </div>
550
- <?php } else { ?>
 
 
 
551
  <div class="grid-date-post">
552
- <?php echo get_the_date('j, M y'); ?><?php echo ($showCategory == 'true' && $cate_name != '') ? ' , '.$cate_name : ""?>
 
 
553
  </div>
554
- <?php } ?>
555
  <div class="post-content-text">
556
  <?php the_title( sprintf( '<h4 class="news-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h4>' ); ?>
557
 
@@ -560,12 +258,16 @@ function get_news( $atts, $content = null ){
560
  <?php echo $cate_name; ?>
561
  </div>
562
  <?php }?>
563
- <?php if($showContent == 'true'){?>
564
- <div class="news-content-excerpt">
565
- <?php $excerpt = get_the_excerpt();?>
566
- <p class="news-short-content"><?php echo string_limit_words($excerpt,$words_limit); ?>...</p>
567
-
568
- <a href="<?php the_permalink(); ?>" class="more-link">Read More</a>
 
 
 
 
569
  </div><!-- .entry-content -->
570
  <?php }?>
571
  </div>
@@ -573,18 +275,21 @@ function get_news( $atts, $content = null ){
573
  </div><!-- #post-## -->
574
  <?php endwhile;
575
  endif; ?>
576
- <div class="news_pagination">
 
 
 
 
 
 
577
 
578
- <div class="button-news-p"><?php previous_posts_link( '<< Previous' ); ?></div>
579
- <div class="button-news-n"><?php next_posts_link( 'Next >>' ); ?> </div>
580
- </div>
581
  <?php
582
  wp_reset_query();
583
 
584
  return ob_get_clean();
585
  }
586
  add_shortcode('sp_news','get_news');
587
- function string_limit_words($string, $word_limit)
588
  {
589
  $words = explode(' ', $string, ($word_limit + 1));
590
  if(count($words) > $word_limit)
@@ -593,7 +298,7 @@ function string_limit_words($string, $word_limit)
593
  }
594
  function mynewsscript() {
595
  $option = 'NewsWidget_option';
596
- $newsscrollingoptionadmin = get_option( $option, $default );
597
  $customscrollpost = $newsscrollingoptionadmin['news_width'];
598
  $customscrollpostheight = $newsscrollingoptionadmin['news_height'];
599
  $customscrollpostdelay = $newsscrollingoptionadmin['news_delay'];
@@ -631,19 +336,58 @@ jQuery(function() {
631
  speed:<?php echo $vspeed; ?>,
632
 
633
  });
634
- jQuery(".newstickerthumb-jcarousellite").jCarouselLite({
635
- vertical: <?php echo $vtrue; ?>,
636
- hoverPause:true,
637
- visible: <?php echo $vvisible; ?>,
638
- auto: <?php echo $vdelay; ?>,
639
- speed:<?php echo $vspeed; ?>,
640
- });
641
  });
642
  </script>
643
  <?php
644
  }
645
  add_action('wp_head', 'mynewsscript');
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  class SP_News_setting
648
  {
649
  /**
@@ -827,4 +571,4 @@ class SP_News_setting
827
 
828
  if( is_admin() )
829
  $my_newssettings_page = new SP_News_setting();
830
- ?>
1
  <?php
2
  /*
3
+ Plugin Name: WP News and three widgets(static, scrolling and with thumbs)
4
  Plugin URL: http://www.wponlinesupport.com/
5
+ Description: A simple News and three widgets(static, scrolling and with thumbs) plugin
6
+ Version: 3.2.2
7
  Author: WP Online Support
8
  Author URI: http://www.wponlinesupport.com/
9
  Contributors: WP Online Support
12
  * Register CPT sp_News
13
  *
14
  */
15
+
16
+ register_activation_hook( __FILE__, 'install_newsfree_version' );
17
+ function install_newsfree_version(){
18
+ if( is_plugin_active('wp-news-and-widget-pro/sp-news-and-widget.php') ){
19
+ add_action('update_option_active_plugins', 'deactivate_newsfree_version');
20
+ }
21
+ }
22
+ function deactivate_newsfree_version(){
23
+ deactivate_plugins('wp-news-and-widget-pro/sp-news-and-widget.php',true);
24
+ }
25
+ add_action( 'admin_notices', 'freenews_admin_notice');
26
+ function freenews_admin_notice() {
27
+ $dir = ABSPATH . 'wp-content/plugins/wp-news-and-widget-pro/sp-news-and-widget.php';
28
+ if( is_plugin_active( 'sp-news-and-widget/sp-news-and-widget.php' ) && file_exists($dir)) {
29
+ global $pagenow;
30
+ if( $pagenow == 'plugins.php' ){
31
+ deactivate_plugins ( 'wp-news-and-widget-pro/sp-news-and-widget.php',true);
32
+ if ( current_user_can( 'install_plugins' ) ) {
33
+ echo '<div id="message" class="updated notice is-dismissible"><p><strong>Thank you for activating WP News and three widgets</strong>.<br /> It looks like you had PRO version <strong>(<em>WP News and Five Widgets Pro</em>)</strong> of this plugin activated. To avoid conflicts the extra version has been deactivated and we recommend you delete it. </p></div>';
34
+ }
35
+ }
36
+ }
37
+ }
38
  // Initialization function
39
  add_action('init', 'sp_cpt_news_init');
40
  function sp_cpt_news_init() {
69
  'capability_type' => 'post',
70
  'has_archive' => true,
71
  'hierarchical' => false,
72
+ 'menu_position' => 5,
73
  'menu_icon' => 'dashicons-feedback',
74
  'supports' => array('title','editor','thumbnail','excerpt','comments'),
75
  'taxonomies' => array('post_tag')
90
  'update_item' => __( 'Update Category' ),
91
  'add_new_item' => __( 'Add New Category' ),
92
  'new_item_name' => __( 'New Category Name' ),
93
+ 'menu_name' => __( 'News Category' ),
94
  );
95
 
96
  $args = array(
115
  wp_enqueue_style( 'cssnews', plugin_dir_url( __FILE__ ). 'css/stylenews.css' );
116
  wp_enqueue_script( 'vticker', plugin_dir_url( __FILE__ ) . 'js/jcarousellite.js', array( 'jquery' ));
117
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
+ require_once( 'widget_function.php' );
120
+ require_once( 'news_menu_function.php' );
121
 
122
  function get_news( $atts, $content = null ){
123
  // setup the query
125
  "limit" => '',
126
  "category" => '',
127
  "grid" => '',
128
+ "show_date" => '',
129
  "show_category_name" => '',
130
  "show_content" => '',
131
+ "show_full_content" => '',
132
  "content_words_limit" => '',
133
  ), $atts));
134
  // Define limit
147
  } else {
148
  $gridcol = '1';
149
  }
150
+ if( $show_date ) {
151
+ $showDate = $show_date;
152
+ } else {
153
+ $showDate = 'true';
154
+ }
155
  if( $show_category_name ) {
156
  $showCategory = $show_category_name;
157
  } else {
161
  $showContent = $show_content;
162
  } else {
163
  $showContent = 'true';
164
+ }
165
+ if( $show_full_content ) {
166
+ $showFullContent = $show_full_content;
167
+ } else {
168
+ $showFullContent = 'false';
169
  }
170
  if( $content_words_limit ) {
171
  $words_limit = $content_words_limit;
173
  $words_limit = '20';
174
  }
175
  ob_start();
176
+
177
+ global $paged;
178
+ if(is_home() || is_front_page()) {
179
+ $paged = get_query_var('page');
180
+ } else {
181
+ $paged = get_query_var('paged');
182
+ }
183
 
184
  $post_type = 'news';
185
  $orderby = 'post_date';
213
  $css_class="team";
214
  if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == ($count - 1) % $grid ) ) || 1 == $count ) { $css_class .= ' first'; }
215
  if ( ( is_numeric( $grid ) && ( $grid > 0 ) && ( 0 == $count % $grid ) ) || $post_count == $count ) { $css_class .= ' last'; }
216
+ if($showDate == 'true'){ $date_class = "has-date";}else{$date_class = "has-no-date";}
217
  ?>
218
 
219
+ <div id="post-<?php the_ID(); ?>" class="news type-news news-col-<?php echo $gridcol.' '.$css_class.' '.$date_class; ?>">
220
  <div class="news-thumb">
221
  <?php
222
  // Post thumbnail.
225
  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('url'); ?></a>
226
  <?php } else if($gridcol > '2') { ?>
227
  <div class="grid-news-thumb">
228
+ <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('large'); ?></a>
229
  </div>
230
  <?php } else { ?>
231
  <div class="grid-news-thumb">
232
+ <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large'); ?></a>
233
  </div>
234
  <?php } }?>
235
  </div>
236
  <div class="news-content">
237
+ <?php if($gridcol == '1') {
238
+ if($showDate == 'true'){?>
239
  <div class="date-post">
240
  <h2><span><?php echo get_the_date('j'); ?></span></h2>
241
  <p><?php echo get_the_date('M y'); ?></p>
 
242
  </div>
243
+ <?php }?>
244
+ <?php } else {
245
+
246
+ ?>
247
  <div class="grid-date-post">
248
+ <?php echo ($showDate == "true")? get_the_date('j, M y') : "" ;?>
249
+ <?php echo ($showDate == "true" && $showCategory == "true" && $cate_name != '') ? " , " : "";?>
250
+ <?php echo ($showCategory == 'true' && $cate_name != '') ? $cate_name : ""?>
251
  </div>
252
+ <?php } ?>
253
  <div class="post-content-text">
254
  <?php the_title( sprintf( '<h4 class="news-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h4>' ); ?>
255
 
258
  <?php echo $cate_name; ?>
259
  </div>
260
  <?php }?>
261
+ <?php if($showContent == 'true'){?>
262
+ <div class="news-content-excerpt">
263
+ <?php if($showFullContent == "false" ) {
264
+ $excerpt = get_the_content();?>
265
+ <p class="news-short-content"><?php echo string_limit_newswords($excerpt,$words_limit); ?>...</p>
266
+
267
+ <a href="<?php the_permalink(); ?>" class="more-link">Read More</a>
268
+ <?php } else {
269
+ the_content();
270
+ } ?>
271
  </div><!-- .entry-content -->
272
  <?php }?>
273
  </div>
275
  </div><!-- #post-## -->
276
  <?php endwhile;
277
  endif; ?>
278
+
279
+ <div class="news_pagination">
280
+
281
+ <div class="button-news-p"><?php next_posts_link( ' Next >>', $query->max_num_pages ); ?></div>
282
+ <div class="button-news-n"><?php previous_posts_link( '<< Previous' ); ?> </div>
283
+ </div>
284
+
285
 
 
 
 
286
  <?php
287
  wp_reset_query();
288
 
289
  return ob_get_clean();
290
  }
291
  add_shortcode('sp_news','get_news');
292
+ function string_limit_newswords($string, $word_limit)
293
  {
294
  $words = explode(' ', $string, ($word_limit + 1));
295
  if(count($words) > $word_limit)
298
  }
299
  function mynewsscript() {
300
  $option = 'NewsWidget_option';
301
+ $newsscrollingoptionadmin = get_option( $option);
302
  $customscrollpost = $newsscrollingoptionadmin['news_width'];
303
  $customscrollpostheight = $newsscrollingoptionadmin['news_height'];
304
  $customscrollpostdelay = $newsscrollingoptionadmin['news_delay'];
336
  speed:<?php echo $vspeed; ?>,
337
 
338
  });
339
+
 
 
 
 
 
 
340
  });
341
  </script>
342
  <?php
343
  }
344
  add_action('wp_head', 'mynewsscript');
345
 
346
+
347
+ function spnews_display_tags( $query ) {
348
+ if( is_tag() && $query->is_main_query() ) {
349
+ $post_types = array( 'post', 'news' );
350
+ $query->set( 'post_type', $post_types );
351
+ }
352
+ }
353
+ add_filter( 'pre_get_posts', 'spnews_display_tags' );
354
+
355
+
356
+ // Manage Category Shortcode Columns
357
+
358
+ add_filter("manage_news-category_custom_column", 'news_category_columns', 10, 3);
359
+ add_filter("manage_edit-news-category_columns", 'news_category_manage_columns');
360
+ function news_category_manage_columns($theme_columns) {
361
+ $new_columns = array(
362
+ 'cb' => '<input type="checkbox" />',
363
+ 'name' => __('Name'),
364
+ 'news_shortcode' => __( 'News Category Shortcode', 'news' ),
365
+ 'slug' => __('Slug'),
366
+ 'posts' => __('Posts')
367
+ );
368
+ return $new_columns;
369
+ }
370
+
371
+ function news_category_columns($out, $column_name, $theme_id) {
372
+ $theme = get_term($theme_id, 'news-category');
373
+ switch ($column_name) {
374
+
375
+ case 'title':
376
+ echo get_the_title();
377
+ break;
378
+ case 'news_shortcode':
379
+
380
+ echo '[sp_news category="' . $theme_id. '"]';
381
+ break;
382
+
383
+ default:
384
+ break;
385
+ }
386
+ return $out;
387
+
388
+ }
389
+
390
+
391
  class SP_News_setting
392
  {
393
  /**
571
 
572
  if( is_admin() )
573
  $my_newssettings_page = new SP_News_setting();
574
+
widget_function.php ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php class SP_News_Widget extends WP_Widget {
2
+
3
+ function SP_News_Widget() {
4
+
5
+ $widget_ops = array('classname' => 'SP_News_Widget', 'description' => __('Displayed Latest News Items from the News in a sidebar', 'news_cpt') );
6
+ $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_widget' );
7
+ $this->WP_Widget( 'sp_news_widget', __('Latest News Widget', 'news_cpt'), $widget_ops, $control_ops );
8
+ }
9
+
10
+ function form($instance) {
11
+ $defaults = array(
12
+ 'limit' => 5,
13
+ 'title' => '',
14
+ "date" => false,
15
+ 'show_category' => false,
16
+ 'category' => 0,
17
+ );
18
+
19
+ $instance = wp_parse_args( (array) $instance, $defaults );
20
+ $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
21
+ $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
22
+ ?>
23
+ <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
24
+ <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
25
+ <p>
26
+ <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
27
+ <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
28
+ </p>
29
+ <p>
30
+ <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
31
+ <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
32
+ </p>
33
+ <p>
34
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
35
+ <?php
36
+ $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
37
+ wp_dropdown_categories( $dropdown_args );
38
+ ?>
39
+ </p>
40
+ <?php
41
+ }
42
+
43
+ function update($new_instance, $old_instance) {
44
+ $instance = $old_instance;
45
+ $instance['title'] = $new_instance['title'];
46
+ $instance['num_items'] = $new_instance['num_items'];
47
+ $instance['date'] = (bool) esc_attr( $new_instance['date'] );
48
+ $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
49
+ $instance['category'] = intval( $new_instance['category'] );
50
+ return $instance;
51
+ }
52
+ function widget($news_args, $instance) {
53
+ extract($news_args, EXTR_SKIP);
54
+
55
+ $current_post_name = get_query_var('name');
56
+
57
+ $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
58
+ $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
59
+ if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
60
+ if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
61
+ if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
62
+ $postcount = 0;
63
+
64
+ echo $before_widget;
65
+
66
+ ?>
67
+ <h4 class="widget-title"><?php echo $title ?></h4>
68
+ <!--visual-columns-->
69
+ <?php if($date == "false" && $show_category == "false"){
70
+ $no_p = "no_p";
71
+ }?>
72
+ <div class="recent-news-items <?php echo $no_p?>">
73
+ <ul>
74
+ <?php // setup the query
75
+ $news_args = array( 'suppress_filters' => true,
76
+ 'posts_per_page' => $num_items,
77
+ 'post_type' => 'news',
78
+ 'order' => 'DESC'
79
+ );
80
+
81
+ if($category != 0){
82
+ $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
83
+ }
84
+ $cust_loop = new WP_Query($news_args);
85
+ $post_count = $cust_loop->post_count;
86
+ $count = 0;
87
+
88
+ if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
89
+ $count++;
90
+ $terms = get_the_terms( $post->ID, 'news-category' );
91
+ $news_links = array();
92
+ if($terms){
93
+
94
+ foreach ( $terms as $term ) {
95
+ $term_link = get_term_link( $term );
96
+ $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
97
+ }
98
+ }
99
+ $cate_name = join( ", ", $news_links );
100
+ ?>
101
+ <li class="news_li">
102
+ <h6> <a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
103
+ <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
104
+ <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
105
+ <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?>
106
+ </li>
107
+ <?php endwhile;
108
+ endif;
109
+ wp_reset_query(); ?>
110
+
111
+ </ul>
112
+ </div>
113
+ <?php
114
+ echo $after_widget;
115
+ }
116
+ }
117
+ /* Register the widget */
118
+ function sp_news_widget_load_widgets() {
119
+ register_widget( 'SP_News_Widget' );
120
+ }
121
+ /* Load the widget */
122
+ add_action( 'widgets_init', 'sp_news_widget_load_widgets' );
123
+ /* scrolling news */
124
+ class SP_News_scrolling_Widget extends WP_Widget {
125
+ function SP_News_scrolling_Widget() {
126
+ $widget_ops = array('classname' => 'SP_News_scrolling_Widget', 'description' => __('Displayed Latest News Items from the News in a sidebar', 'news_cpt') );
127
+ $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_s_widget' );
128
+ $this->WP_Widget( 'sp_news_s_widget', __('Latest News Scrolling Widget', 'news_cpt'), $widget_ops, $control_ops );
129
+ }
130
+ function form($instance) {
131
+ $defaults = array(
132
+ 'limit' => 5,
133
+ 'title' => '',
134
+ "date" => false,
135
+ 'show_category' => false,
136
+ 'category' => 0,
137
+ );
138
+
139
+ $instance = wp_parse_args( (array) $instance, $defaults );
140
+ $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
141
+ $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
142
+ ?>
143
+ <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
144
+ <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
145
+ <p>
146
+ <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
147
+ <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
148
+ </p>
149
+ <p>
150
+ <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
151
+ <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
152
+ </p>
153
+ <p>
154
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
155
+ <?php
156
+ $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
157
+ wp_dropdown_categories( $dropdown_args );
158
+ ?>
159
+ </p>
160
+ <?php
161
+ }
162
+
163
+ function update($new_instance, $old_instance) {
164
+ $instance = $old_instance;
165
+ $instance['title'] = $new_instance['title'];
166
+ $instance['num_items'] = $new_instance['num_items'];
167
+ $instance['date'] = (bool) esc_attr( $new_instance['date'] );
168
+ $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
169
+ $instance['category'] = intval( $new_instance['category'] );
170
+ return $instance;
171
+ }
172
+ function widget($news_args, $instance) {
173
+ extract($news_args, EXTR_SKIP);
174
+ $current_post_name = get_query_var('name');
175
+ $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
176
+ $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
177
+ if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
178
+ if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
179
+ if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
180
+ $postcount = 0;
181
+
182
+ echo $before_widget;
183
+
184
+ ?>
185
+ <h4 class="widget-title"><?php echo $title ?></h4>
186
+ <!--visual-columns-->
187
+ <?php if($date == "false" && $show_category == "false"){
188
+ $no_p = "no_p";
189
+ }?>
190
+ <div class="recent-news-items <?php echo $no_p;?>">
191
+ <div class="newsticker-jcarousellite">
192
+ <ul>
193
+ <?php // setup the query
194
+ $news_args = array( 'suppress_filters' => true,
195
+ 'posts_per_page' => $num_items,
196
+ 'post_type' => 'news',
197
+ 'order' => 'DESC'
198
+ );
199
+ if($category != 0){
200
+ $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
201
+ }
202
+ $cust_loop = new WP_Query($news_args);
203
+ $post_count = $cust_loop->post_count;
204
+ $count = 0;
205
+
206
+ if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
207
+ $count++;
208
+ $terms = get_the_terms( $post->ID, 'news-category' );
209
+ $news_links = array();
210
+ if($terms){
211
+
212
+ foreach ( $terms as $term ) {
213
+ $term_link = get_term_link( $term );
214
+ $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
215
+ }
216
+ }
217
+ $cate_name = join( ", ", $news_links );
218
+ ?>
219
+ <li class="news_li">
220
+ <h6><a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
221
+ <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
222
+ <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
223
+ <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?>
224
+ </li>
225
+ <?php endwhile;
226
+ endif;
227
+ wp_reset_query(); ?>
228
+ </ul>
229
+ </div>
230
+ </div>
231
+ <?php
232
+ echo $after_widget;
233
+ }
234
+ }
235
+
236
+ /* Register the widget */
237
+ function sp_news_scroll_widget_load_widgets() {
238
+ register_widget( 'SP_News_scrolling_Widget' );
239
+ }
240
+
241
+ /* Load the widget */
242
+ add_action( 'widgets_init', 'sp_news_scroll_widget_load_widgets' );
243
+
244
+ /* news with thumb */
245
+ class SP_News_thmb_Widget extends WP_Widget {
246
+
247
+ function SP_News_thmb_Widget() {
248
+
249
+ $widget_ops = array('classname' => 'SP_News_thmb_Widget', 'description' => __('Displayed Latest News Items in a sidebar with thumbnails', 'news_cpt') );
250
+ $control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_sthumb_widget' );
251
+ $this->WP_Widget( 'sp_news_sthumb_widget', __('Latest News with thumb', 'news_cpt'), $widget_ops, $control_ops );
252
+ }
253
+
254
+ function form($instance) {
255
+ $defaults = array(
256
+ 'limit' => 5,
257
+ 'title' => '',
258
+ "date" => false,
259
+ 'show_category' => false,
260
+ 'category' => 0,
261
+ );
262
+
263
+ $instance = wp_parse_args( (array) $instance, $defaults );
264
+ $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
265
+ $num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
266
+ ?>
267
+ <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
268
+ <p><label for="<?php echo $this->get_field_id('num_items'); ?>">Number of Items: <input class="widefat" id="<?php echo $this->get_field_id('num_items'); ?>" name="<?php echo $this->get_field_name('num_items'); ?>" type="text" value="<?php echo attribute_escape($num_items); ?>" /></label></p>
269
+ <p>
270
+ <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox"<?php checked( $instance['date'], 1 ); ?> />
271
+ <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Display Date', 'news' ); ?></label>
272
+ </p>
273
+ <p>
274
+ <input id="<?php echo $this->get_field_id( 'show_category' ); ?>" name="<?php echo $this->get_field_name( 'show_category' ); ?>" type="checkbox"<?php checked( $instance['show_category'], 1 ); ?> />
275
+ <label for="<?php echo $this->get_field_id( 'show_category' ); ?>"><?php _e( 'Display Category', 'news' ); ?></label>
276
+ </p>
277
+ <p>
278
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'news' ); ?></label>
279
+ <?php
280
+ $dropdown_args = array( 'taxonomy' => 'news-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'news' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
281
+ wp_dropdown_categories( $dropdown_args );
282
+ ?>
283
+ </p>
284
+ <?php
285
+ }
286
+
287
+ function update($new_instance, $old_instance) {
288
+ $instance = $old_instance;
289
+ $instance['title'] = $new_instance['title'];
290
+ $instance['num_items'] = $new_instance['num_items'];
291
+ $instance['date'] = (bool) esc_attr( $new_instance['date'] );
292
+ $instance['show_category'] = (bool) esc_attr( $new_instance['show_category'] );
293
+ $instance['category'] = intval( $new_instance['category'] );
294
+ return $instance;
295
+ }
296
+ function widget($news_args, $instance) {
297
+ extract($news_args, EXTR_SKIP);
298
+
299
+ $current_post_name = get_query_var('name');
300
+
301
+ $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
302
+ $num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
303
+ if ( isset( $instance['date'] ) && ( 1 == $instance['date'] ) ) { $date = "true"; } else { $date = "false"; }
304
+ if ( isset( $instance['show_category'] ) && ( 1 == $instance['show_category'] ) ) { $show_category = "true"; } else { $show_category = "false"; }
305
+ if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $category = intval( $instance['category'] );
306
+ $postcount = 0;
307
+ echo $before_widget;
308
+ ?>
309
+ <h4 class="widget-title"><?php echo $title ?></h4>
310
+ <!--visual-columns-->
311
+ <?php if($date == "false" && $show_category == "false"){
312
+ $no_p = "no_p";
313
+ }?>
314
+ <div class="recent-news-items <?php echo $no_p;?>">
315
+ <div class="newstickerthumb">
316
+ <ul>
317
+ <?php // setup the query
318
+ $news_args = array( 'suppress_filters' => true,
319
+ 'posts_per_page' => $num_items,
320
+ 'post_type' => 'news',
321
+ 'order' => 'DESC'
322
+ );
323
+ if($category != 0){
324
+ $news_args['tax_query'] = array( array( 'taxonomy' => 'news-category', 'field' => 'id', 'terms' => $category) );
325
+ }
326
+
327
+ $cust_loop = new WP_Query($news_args);
328
+ $post_count = $cust_loop->post_count;
329
+ $count = 0;
330
+ if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
331
+ $count++;
332
+ $terms = get_the_terms( $post->ID, 'news-category' );
333
+ $news_links = array();
334
+ if($terms){
335
+
336
+ foreach ( $terms as $term ) {
337
+ $term_link = get_term_link( $term );
338
+ $news_links[] = '<a href="' . esc_url( $term_link ) . '">'.$term->name.'</a>';
339
+ }
340
+ }
341
+ $cate_name = join( ", ", $news_links );
342
+ ?>
343
+ <li class="news_li">
344
+ <div class="news_thumb_left">
345
+ <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
346
+
347
+ <?php
348
+ if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
349
+ the_post_thumbnail( array(80,80) );
350
+ }
351
+ ?> </a></div>
352
+ <div class="news_thumb_right">
353
+ <h6><a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
354
+ <?php echo ($date == "true")? '<p>'.get_the_date('j, M y') : "" ;?>
355
+ <?php echo ($date == "true" && $show_category == "true" && $cate_name != '') ? " , " : "";?>
356
+ <?php echo ($show_category == 'true' && $cate_name != '') ? $cate_name.'</p>' : ""?></div>
357
+
358
+ </li>
359
+ <?php endwhile;
360
+ endif;
361
+ wp_reset_query(); ?>
362
+
363
+ </ul>
364
+ </div> </div>
365
+ <?php
366
+ echo $after_widget;
367
+ }
368
+ }
369
+ /* Register the widget */
370
+ function sp_news_thumb_widget_load_widgets() {
371
+ register_widget( 'SP_News_thmb_Widget' );
372
+ }
373
+
374
+ /* Load the widget */
375
+ add_action( 'widgets_init', 'sp_news_thumb_widget_load_widgets' );