Version Description
- Display News with List view
- Display News with Grid [sp_news grid="2"]
- Added pagination [sp_news limit="10"]
Download this release
Release Info
Developer | anoopranawat |
Plugin | WP News and Scrolling Widgets |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 3.0
- css/stylenews.css +39 -4
- images/Thumbs.db +0 -0
- js/jcarousellite.js +8 -364
- readme.txt +31 -15
- sp-news-and-widget.php +633 -576
css/stylenews.css
CHANGED
@@ -1,10 +1,45 @@
|
|
|
|
|
|
|
|
1 |
|
2 |
-
.
|
3 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
|
9 |
-
.sp-news{overflow:hidden; clear:both !important;}
|
10 |
|
1 |
+
.news-col-3, .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 .news-title{margin-top:0px;}
|
7 |
+
.news-content{float:left; width:100%; clear:both;}
|
8 |
+
.date-post{width: 11%;float: left;text-align: center;}
|
9 |
+
.date-post span{display: block;color: #222;font-size: 30px;margin: 0px 0px 2px;padding-bottom: 2px;border-bottom: 1px dotted #C0C0C0;}
|
10 |
+
.date-post h2{margin-bottom:5px !important; padding-bottom:0 !important; margin-top:0px !important; text-align:center;}
|
11 |
+
.date-post p{margin: 0px;text-transform: uppercase;color: #333; text-align:center !important}
|
12 |
+
.post-content-text{width:87%; margin-left:2%; float:left;}
|
13 |
+
.news-thumb{float:left; width:100%; margin-bottom:25px;}
|
14 |
+
.news-thumb img{width:100%; height:auto; margin:0px !important;}
|
15 |
|
16 |
+
.news_thumb_left{width:80px; float:left;}
|
17 |
+
.news_thumb_left img{width:100%;}
|
18 |
+
.news_thumb_right{margin-left:85px;}
|
19 |
+
|
20 |
+
.news_pagination{clear:both; padding:20px 0; float:left; width:100%}
|
21 |
+
.button-news-p{width:49%; float:left; text-align:left}
|
22 |
+
.button-news-n{width:49%; float:right; text-align:right}
|
23 |
+
|
24 |
+
.recent-news-items{clear:both;}
|
25 |
+
|
26 |
+
.news-col-3{width:33%; float:left; clear:none !important; padding:0 15px;}
|
27 |
+
.news-col-2{width:50%; float:left; clear:none !important; padding:0 15px;}
|
28 |
+
.news-col-1{width:100%; float:left;}
|
29 |
+
|
30 |
+
.grid-news-thumb{float: left; height: 160px;line-height: 0; overflow: hidden; position: relative; width: 100%;}
|
31 |
+
.grid-news-thumb img{margin: 0 auto;opacity: 1;position: absolute; }
|
32 |
+
|
33 |
+
.news-col-3 h2, .news-col-2 h2{font-size:18px !important; line-height:20px !important; font-weight: normal !important}
|
34 |
+
.news-col-3 .news-content-excerpt, .news-col-2 .news-content-excerpt{display:none;}
|
35 |
+
.news-col-3 .news-thumb, .news-col-2 .news-thumb{margin-bottom:5px;}
|
36 |
+
.news-col-3 .post-content-text, .news-col-2 .post-content-text{width:100%; margin:0px;}
|
37 |
+
|
38 |
+
@media all and (max-width: 768px) {
|
39 |
+
.news-col-3, .news-col-2{width:100%;}
|
40 |
+
|
41 |
+
}
|
42 |
|
43 |
|
44 |
|
|
|
45 |
|
images/Thumbs.db
DELETED
Binary file
|
js/jcarousellite.js
CHANGED
@@ -1,364 +1,8 @@
|
|
1 |
-
|
2 |
-
* jCarouselLite -
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
* http://www.opensource.org/licenses/mit-license.php
|
10 |
-
* http://www.gnu.org/licenses/gpl.html
|
11 |
-
*
|
12 |
-
* Version: 1.0.1
|
13 |
-
* Note: Requires jquery 1.2 or above from version 1.0.1
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
|
18 |
-
*
|
19 |
-
* The HTML markup that is used to build the carousel can be as simple as...
|
20 |
-
*
|
21 |
-
* <div class="carousel">
|
22 |
-
* <ul>
|
23 |
-
* <li><img src="image/1.jpg" alt="1"></li>
|
24 |
-
* <li><img src="image/2.jpg" alt="2"></li>
|
25 |
-
* <li><img src="image/3.jpg" alt="3"></li>
|
26 |
-
* </ul>
|
27 |
-
* </div>
|
28 |
-
*
|
29 |
-
* As you can see, this snippet is nothing but a simple div containing an unordered list of images.
|
30 |
-
* You don't need any special "class" attribute, or a special "css" file for this plugin.
|
31 |
-
* I am using a class attribute just for the sake of explanation here.
|
32 |
-
*
|
33 |
-
* To navigate the elements of the carousel, you need some kind of navigation buttons.
|
34 |
-
* For example, you will need a "previous" button to go backward, and a "next" button to go forward.
|
35 |
-
* This need not be part of the carousel "div" itself. It can be any element in your page.
|
36 |
-
* Lets assume that the following elements in your document can be used as next, and prev buttons...
|
37 |
-
*
|
38 |
-
* <button class="prev"><<</button>
|
39 |
-
* <button class="next">>></button>
|
40 |
-
*
|
41 |
-
* Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
|
42 |
-
* navigation buttons as options.
|
43 |
-
*
|
44 |
-
* $(".carousel").jCarouselLite({
|
45 |
-
* btnNext: ".next",
|
46 |
-
* btnPrev: ".prev"
|
47 |
-
* });
|
48 |
-
*
|
49 |
-
* That's it, you would have now converted your raw div, into a magnificient carousel.
|
50 |
-
*
|
51 |
-
* There are quite a few other options that you can use to customize it though.
|
52 |
-
* Each will be explained with an example below.
|
53 |
-
*
|
54 |
-
* @param an options object - You can specify all the options shown below as an options object param.
|
55 |
-
*
|
56 |
-
* @option btnPrev, btnNext : string - no defaults
|
57 |
-
* @example
|
58 |
-
* $(".carousel").jCarouselLite({
|
59 |
-
* btnNext: ".next",
|
60 |
-
* btnPrev: ".prev"
|
61 |
-
* });
|
62 |
-
* @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
|
63 |
-
*
|
64 |
-
* @option btnGo - array - no defaults
|
65 |
-
* @example
|
66 |
-
* $(".carousel").jCarouselLite({
|
67 |
-
* btnNext: ".next",
|
68 |
-
* btnPrev: ".prev",
|
69 |
-
* btnGo: [".0", ".1", ".2"]
|
70 |
-
* });
|
71 |
-
* @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
|
72 |
-
* the item number within the carousel, you can use this option. Just supply an array of selectors for each element
|
73 |
-
* in the carousel. The index of the array represents the index of the element. What i mean is, if the
|
74 |
-
* first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
|
75 |
-
* will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
|
76 |
-
* interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
|
77 |
-
* any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
|
78 |
-
* The best part is that, the tab will "slide" based on the provided effect. :-)
|
79 |
-
*
|
80 |
-
* @option mouseWheel : boolean - default is false
|
81 |
-
* @example
|
82 |
-
* $(".carousel").jCarouselLite({
|
83 |
-
* mouseWheel: true
|
84 |
-
* });
|
85 |
-
* @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
|
86 |
-
* To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
|
87 |
-
* Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
|
88 |
-
* using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
|
89 |
-
* as well. They complement each other. To use both together, just supply the options required for both as shown below.
|
90 |
-
* @example
|
91 |
-
* $(".carousel").jCarouselLite({
|
92 |
-
* btnNext: ".next",
|
93 |
-
* btnPrev: ".prev",
|
94 |
-
* mouseWheel: true
|
95 |
-
* });
|
96 |
-
*
|
97 |
-
* @option auto : number - default is null, meaning autoscroll is disabled by default
|
98 |
-
* @example
|
99 |
-
* $(".carousel").jCarouselLite({
|
100 |
-
* auto: 800,
|
101 |
-
* speed: 500
|
102 |
-
* });
|
103 |
-
* @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
|
104 |
-
* The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
|
105 |
-
* Specify this value and magically your carousel will start auto scrolling.
|
106 |
-
*
|
107 |
-
* @option speed : number - 200 is default
|
108 |
-
* @example
|
109 |
-
* $(".carousel").jCarouselLite({
|
110 |
-
* btnNext: ".next",
|
111 |
-
* btnPrev: ".prev",
|
112 |
-
* speed: 800
|
113 |
-
* });
|
114 |
-
* @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
|
115 |
-
* different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
|
116 |
-
*
|
117 |
-
* @option easing : string - no easing effects by default.
|
118 |
-
* @example
|
119 |
-
* $(".carousel").jCarouselLite({
|
120 |
-
* btnNext: ".next",
|
121 |
-
* btnPrev: ".prev",
|
122 |
-
* easing: "bounceout"
|
123 |
-
* });
|
124 |
-
* @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
|
125 |
-
* the carousel will slide based on the provided easing effect.
|
126 |
-
*
|
127 |
-
* @option vertical : boolean - default is false
|
128 |
-
* @example
|
129 |
-
* $(".carousel").jCarouselLite({
|
130 |
-
* btnNext: ".next",
|
131 |
-
* btnPrev: ".prev",
|
132 |
-
* vertical: true
|
133 |
-
* });
|
134 |
-
* @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
|
135 |
-
* prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
|
136 |
-
* display horizontally. The next and prev items will slide the items from left-right in this case.
|
137 |
-
*
|
138 |
-
* @option circular : boolean - default is true
|
139 |
-
* @example
|
140 |
-
* $(".carousel").jCarouselLite({
|
141 |
-
* btnNext: ".next",
|
142 |
-
* btnPrev: ".prev",
|
143 |
-
* circular: false
|
144 |
-
* });
|
145 |
-
* @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
|
146 |
-
* element, you will automatically slide to the first element and vice versa. If you set circular to false, then
|
147 |
-
* if you click on the "next" button after you reach the last element, you will stay in the last element itself
|
148 |
-
* and similarly for "previous" button and first element.
|
149 |
-
*
|
150 |
-
* @option visible : number - default is 3
|
151 |
-
* @example
|
152 |
-
* $(".carousel").jCarouselLite({
|
153 |
-
* btnNext: ".next",
|
154 |
-
* btnPrev: ".prev",
|
155 |
-
* visible: 4
|
156 |
-
* });
|
157 |
-
* @desc This specifies the number of items visible at all times within the carousel. The default is 3.
|
158 |
-
* You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
|
159 |
-
* last item half visible. This gives you the effect of showing the user that there are more images to the right.
|
160 |
-
*
|
161 |
-
* @option start : number - default is 0
|
162 |
-
* @example
|
163 |
-
* $(".carousel").jCarouselLite({
|
164 |
-
* btnNext: ".next",
|
165 |
-
* btnPrev: ".prev",
|
166 |
-
* start: 2
|
167 |
-
* });
|
168 |
-
* @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
|
169 |
-
* has a start of 0, and so on.
|
170 |
-
*
|
171 |
-
* @option scrool : number - default is 1
|
172 |
-
* @example
|
173 |
-
* $(".carousel").jCarouselLite({
|
174 |
-
* btnNext: ".next",
|
175 |
-
* btnPrev: ".prev",
|
176 |
-
* scroll: 2
|
177 |
-
* });
|
178 |
-
* @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
|
179 |
-
* default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
|
180 |
-
* 2 items when you click the next or previous buttons.
|
181 |
-
*
|
182 |
-
* @option beforeStart, afterEnd : function - callbacks
|
183 |
-
* @example
|
184 |
-
* $(".carousel").jCarouselLite({
|
185 |
-
* btnNext: ".next",
|
186 |
-
* btnPrev: ".prev",
|
187 |
-
* beforeStart: function(a) {
|
188 |
-
* alert("Before animation starts:" + a);
|
189 |
-
* },
|
190 |
-
* afterEnd: function(a) {
|
191 |
-
* alert("After animation ends:" + a);
|
192 |
-
* }
|
193 |
-
* });
|
194 |
-
* @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
|
195 |
-
* register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
|
196 |
-
* are visible at the time of callback.
|
197 |
-
*
|
198 |
-
*
|
199 |
-
* @cat Plugins/Image Gallery
|
200 |
-
* @author Ganeshji Marwaha/ganeshread@gmail.com
|
201 |
-
*/
|
202 |
-
|
203 |
-
(function($) { // Compliant with jquery.noConflict()
|
204 |
-
$.fn.jCarouselLite = function(o) {
|
205 |
-
o = $.extend({
|
206 |
-
btnPrev: null,
|
207 |
-
btnNext: null,
|
208 |
-
btnGo: null,
|
209 |
-
mouseWheel: false,
|
210 |
-
auto: null,
|
211 |
-
hoverPause: false,
|
212 |
-
|
213 |
-
speed: 200,
|
214 |
-
easing: null,
|
215 |
-
|
216 |
-
vertical: false,
|
217 |
-
circular: true,
|
218 |
-
visible: 3,
|
219 |
-
start: 0,
|
220 |
-
scroll: 1,
|
221 |
-
|
222 |
-
beforeStart: null,
|
223 |
-
afterEnd: null
|
224 |
-
}, o || {});
|
225 |
-
|
226 |
-
return this.each(function() { // Returns the element collection. Chainable.
|
227 |
-
|
228 |
-
var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
|
229 |
-
var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
|
230 |
-
|
231 |
-
if(o.circular) {
|
232 |
-
ul.prepend(tLi.slice(tl-v+1).clone())
|
233 |
-
.append(tLi.slice(0,o.scroll).clone());
|
234 |
-
o.start += v-1;
|
235 |
-
}
|
236 |
-
|
237 |
-
var li = $("li", ul), itemLength = li.size(), curr = o.start;
|
238 |
-
div.css("visibility", "visible");
|
239 |
-
|
240 |
-
li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
|
241 |
-
ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
|
242 |
-
div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
|
243 |
-
|
244 |
-
var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
|
245 |
-
var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
|
246 |
-
var divSize = liSize * v; // size of entire div(total length for just the visible items)
|
247 |
-
|
248 |
-
li.css({width: li.width(), height: li.height()});
|
249 |
-
ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
|
250 |
-
|
251 |
-
div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images
|
252 |
-
|
253 |
-
if(o.btnPrev) {
|
254 |
-
$(o.btnPrev).click(function() {
|
255 |
-
return go(curr-o.scroll);
|
256 |
-
});
|
257 |
-
if(o.hoverPause) {
|
258 |
-
$(o.btnPrev).hover(function(){stopAuto();}, function(){startAuto();});
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
|
263 |
-
if(o.btnNext) {
|
264 |
-
$(o.btnNext).click(function() {
|
265 |
-
return go(curr+o.scroll);
|
266 |
-
});
|
267 |
-
if(o.hoverPause) {
|
268 |
-
$(o.btnNext).hover(function(){stopAuto();}, function(){startAuto();});
|
269 |
-
}
|
270 |
-
}
|
271 |
-
|
272 |
-
if(o.btnGo)
|
273 |
-
$.each(o.btnGo, function(i, val) {
|
274 |
-
$(val).click(function() {
|
275 |
-
return go(o.circular ? o.visible+i : i);
|
276 |
-
});
|
277 |
-
});
|
278 |
-
|
279 |
-
if(o.mouseWheel && div.mousewheel)
|
280 |
-
div.mousewheel(function(e, d) {
|
281 |
-
return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
|
282 |
-
});
|
283 |
-
|
284 |
-
var autoInterval;
|
285 |
-
|
286 |
-
function startAuto() {
|
287 |
-
stopAuto();
|
288 |
-
autoInterval = setInterval(function() {
|
289 |
-
go(curr+o.scroll);
|
290 |
-
}, o.auto+o.speed);
|
291 |
-
};
|
292 |
-
|
293 |
-
function stopAuto() {
|
294 |
-
clearInterval(autoInterval);
|
295 |
-
};
|
296 |
-
|
297 |
-
if(o.auto) {
|
298 |
-
if(o.hoverPause) {
|
299 |
-
div.hover(function(){stopAuto();}, function(){startAuto();});
|
300 |
-
}
|
301 |
-
startAuto();
|
302 |
-
};
|
303 |
-
|
304 |
-
function vis() {
|
305 |
-
return li.slice(curr).slice(0,v);
|
306 |
-
};
|
307 |
-
|
308 |
-
function go(to) {
|
309 |
-
if(!running) {
|
310 |
-
|
311 |
-
if(o.beforeStart)
|
312 |
-
o.beforeStart.call(this, vis());
|
313 |
-
|
314 |
-
if(o.circular) { // If circular we are in first or last, then goto the other end
|
315 |
-
if(to<0) { // If before range, then go around
|
316 |
-
ul.css(animCss, -( (curr + tl) * liSize)+"px");
|
317 |
-
curr = to + tl;
|
318 |
-
} else if(to>itemLength-v) { // If beyond range, then come around
|
319 |
-
ul.css(animCss, -( (curr - tl) * liSize ) + "px" );
|
320 |
-
curr = to - tl;
|
321 |
-
} else curr = to;
|
322 |
-
} else { // If non-circular and to points to first or last, we just return.
|
323 |
-
if(to<0 || to>itemLength-v) return;
|
324 |
-
else curr = to;
|
325 |
-
} // If neither overrides it, the curr will still be "to" and we can proceed.
|
326 |
-
|
327 |
-
running = true;
|
328 |
-
|
329 |
-
ul.animate(
|
330 |
-
animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
|
331 |
-
function() {
|
332 |
-
if(o.afterEnd)
|
333 |
-
o.afterEnd.call(this, vis());
|
334 |
-
running = false;
|
335 |
-
}
|
336 |
-
);
|
337 |
-
// Disable buttons when the carousel reaches the last/first, and enable when not
|
338 |
-
if(!o.circular) {
|
339 |
-
$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
|
340 |
-
$( (curr-o.scroll<0 && o.btnPrev)
|
341 |
-
||
|
342 |
-
(curr+o.scroll > itemLength-v && o.btnNext)
|
343 |
-
||
|
344 |
-
[]
|
345 |
-
).addClass("disabled");
|
346 |
-
}
|
347 |
-
|
348 |
-
}
|
349 |
-
return false;
|
350 |
-
};
|
351 |
-
});
|
352 |
-
};
|
353 |
-
|
354 |
-
function css(el, prop) {
|
355 |
-
return parseInt($.css(el[0], prop)) || 0;
|
356 |
-
};
|
357 |
-
function width(el) {
|
358 |
-
return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
|
359 |
-
};
|
360 |
-
function height(el) {
|
361 |
-
return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
|
362 |
-
};
|
363 |
-
|
364 |
-
})(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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
===
|
2 |
-
Contributors:
|
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.
|
6 |
-
Author URI: http://
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -14,6 +14,8 @@ A quick, easy way to add an News custom post type, News widget, vertical and hor
|
|
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 [screenshots](http://wordpress.org/plugins/sp-news-and-widget/screenshots/) for additional information.
|
18 |
|
19 |
= Installation help and support =
|
@@ -22,21 +24,23 @@ View [screenshots](http://wordpress.org/plugins/sp-news-and-widget/screenshots/)
|
|
22 |
|
23 |
= Important Note For How to Install =
|
24 |
* 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"
|
25 |
-
* Now you can Display news post with the help of short code
|
26 |
<code> [sp_news] </code>
|
27 |
-
* Also you can Display the news post with category wise
|
28 |
-
|
29 |
-
*
|
30 |
-
<code>
|
31 |
-
|
|
|
|
|
32 |
|
33 |
Arts news
|
34 |
-
[sp_news category=category_id]
|
35 |
</code>
|
36 |
|
37 |
* Comments for the news
|
38 |
|
39 |
-
* 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
|
40 |
|
41 |
This plugin add a News custom post type, News widget, vertical and horizontal news scrolling widget( With setting page 'setting -> News Widget Setting') to your Wordpress site.
|
42 |
|
@@ -50,7 +54,9 @@ Finally, the plugin adds a Recent News Items widget and vertical news scrolling
|
|
50 |
|
51 |
= Added New Features : =
|
52 |
* Shortcode <code> [sp_news] </code> for news page.
|
53 |
-
* Category wise News <code> Sports news [sp_news category=category_id] </code>
|
|
|
|
|
54 |
|
55 |
|
56 |
= Features include: =
|
@@ -95,9 +101,9 @@ Yse <code> [sp_news] </code>.
|
|
95 |
|
96 |
== Screenshots ==
|
97 |
|
98 |
-
1.
|
99 |
2. A complate view with comments
|
100 |
-
3.
|
101 |
4. Add new news
|
102 |
5. Single News view
|
103 |
6. Widgets
|
@@ -105,6 +111,11 @@ Yse <code> [sp_news] </code>.
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
= 2.2.1 =
|
109 |
* fixed the bug : Shows news on top of static page
|
110 |
|
@@ -135,6 +146,11 @@ Yse <code> [sp_news] </code>.
|
|
135 |
|
136 |
== Upgrade Notice ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
138 |
= 2.2.1 =
|
139 |
* fixed the bug : Shows news on top of static page
|
140 |
|
1 |
+
=== WP News and Scrolling Widgets ===
|
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
|
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 =
|
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"
|
27 |
+
* Now you can Display news post with the help of short code :
|
28 |
<code> [sp_news] </code>
|
29 |
+
* Also you can Display the news post with category wise :
|
30 |
+
<code> Sports news [sp_news category="category_id"] </code>
|
31 |
+
* Display News with Grid:
|
32 |
+
<code>[sp_news grid="2"] </code>
|
33 |
+
* Also you can Display the news post with Multiple categories wise
|
34 |
+
<code> Sports news :
|
35 |
+
[sp_news category="category_id"]
|
36 |
|
37 |
Arts news
|
38 |
+
[sp_news category="category_id"]
|
39 |
</code>
|
40 |
|
41 |
* Comments for the news
|
42 |
|
43 |
+
* 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.
|
44 |
|
45 |
This plugin add a News custom post type, News widget, vertical and horizontal news scrolling widget( With setting page 'setting -> News Widget Setting') to your Wordpress site.
|
46 |
|
54 |
|
55 |
= Added New Features : =
|
56 |
* Shortcode <code> [sp_news] </code> for news page.
|
57 |
+
* Category wise News <code> Sports news [sp_news category="category_id"] </code>
|
58 |
+
* Display News with Grid [sp_news grid="2"]
|
59 |
+
* Added pagination [sp_news limit="10"]
|
60 |
|
61 |
|
62 |
= Features include: =
|
101 |
|
102 |
== Screenshots ==
|
103 |
|
104 |
+
1. Display News with grid view
|
105 |
2. A complate view with comments
|
106 |
+
3. Display News with List view
|
107 |
4. Add new news
|
108 |
5. Single News view
|
109 |
6. Widgets
|
111 |
|
112 |
== Changelog ==
|
113 |
|
114 |
+
= 3.0 =
|
115 |
+
* Display News with List view
|
116 |
+
* Display News with Grid [sp_news grid="2"]
|
117 |
+
* Added pagination [sp_news limit="10"]
|
118 |
+
|
119 |
= 2.2.1 =
|
120 |
* fixed the bug : Shows news on top of static page
|
121 |
|
146 |
|
147 |
== Upgrade Notice ==
|
148 |
|
149 |
+
= 3.0 =
|
150 |
+
* Display News with List view
|
151 |
+
* Display News with Grid [sp_news grid="2"]
|
152 |
+
* Added pagination [sp_news limit="10"]
|
153 |
+
|
154 |
= 2.2.1 =
|
155 |
* fixed the bug : Shows news on top of static page
|
156 |
|
sp-news-and-widget.php
CHANGED
@@ -1,576 +1,633 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name:
|
4 |
-
Plugin URL: http://
|
5 |
-
Description: A simple News and three widgets(static, scrolling and scrolling with thumbs) plugin
|
6 |
-
Version:
|
7 |
-
Author:
|
8 |
-
Author URI: http://
|
9 |
-
Contributors:
|
10 |
-
*/
|
11 |
-
/*
|
12 |
-
* Register CPT sp_News
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
// Initialization function
|
16 |
-
add_action('init', 'sp_cpt_news_init');
|
17 |
-
function sp_cpt_news_init() {
|
18 |
-
// Create new News custom post type
|
19 |
-
$news_labels = array(
|
20 |
-
'name' => _x('News', 'post type general name'),
|
21 |
-
'singular_name' => _x('News', 'post type singular name'),
|
22 |
-
'add_new' => _x('Add News Item', 'news'),
|
23 |
-
'add_new_item' => __('Add New News Item'),
|
24 |
-
'edit_item' => __('Edit News Item'),
|
25 |
-
'new_item' => __('New News Item'),
|
26 |
-
'view_item' => __('View News Item'),
|
27 |
-
'search_items' => __('Search News Items'),
|
28 |
-
'not_found' => __('No News Items found'),
|
29 |
-
'not_found_in_trash' => __('No News Items found in Trash'),
|
30 |
-
'_builtin' => false,
|
31 |
-
'parent_item_colon' => '',
|
32 |
-
'menu_name' => 'News'
|
33 |
-
);
|
34 |
-
$news_args = array(
|
35 |
-
'labels' => $news_labels,
|
36 |
-
'public' => true,
|
37 |
-
'publicly_queryable' => true,
|
38 |
-
'exclude_from_search' => false,
|
39 |
-
'show_ui' => true,
|
40 |
-
'show_in_menu' => true,
|
41 |
-
'query_var' => true,
|
42 |
-
'rewrite' => array(
|
43 |
-
'slug' => 'news',
|
44 |
-
'with_front' => false
|
45 |
-
),
|
46 |
-
'capability_type' => 'post',
|
47 |
-
'has_archive' => true,
|
48 |
-
'hierarchical' => false,
|
49 |
-
'menu_position' => 8,
|
50 |
-
|
51 |
-
'supports' => array('title','editor','thumbnail','excerpt','comments'),
|
52 |
-
'taxonomies' => array('category', 'post_tag')
|
53 |
-
);
|
54 |
-
register_post_type('news',$news_args);
|
55 |
-
}
|
56 |
-
|
57 |
-
function my_rewrite_flush() {
|
58 |
-
sp_cpt_news_init();
|
59 |
-
flush_rewrite_rules();
|
60 |
-
}
|
61 |
-
register_activation_hook( __FILE__, 'my_rewrite_flush' );
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
$
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
$
|
167 |
-
|
168 |
-
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
$
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
}
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
if( $
|
308 |
-
$
|
309 |
-
} else {
|
310 |
-
$
|
311 |
-
}
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
</
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
);
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
'
|
475 |
-
'
|
476 |
-
|
477 |
-
'
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
'
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
'
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
'
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP News and three widgets(static, scrolling and scrolling with thumbs)
|
4 |
+
Plugin URL: http://wponlinesupport.com
|
5 |
+
Description: A simple News and three widgets(static, scrolling and scrolling with thumbs) plugin
|
6 |
+
Version: 3.0
|
7 |
+
Author: WP Online Support
|
8 |
+
Author URI: http://wponlinesupport.com
|
9 |
+
Contributors: WP Online Support
|
10 |
+
*/
|
11 |
+
/*
|
12 |
+
* Register CPT sp_News
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
// Initialization function
|
16 |
+
add_action('init', 'sp_cpt_news_init');
|
17 |
+
function sp_cpt_news_init() {
|
18 |
+
// Create new News custom post type
|
19 |
+
$news_labels = array(
|
20 |
+
'name' => _x('News', 'post type general name'),
|
21 |
+
'singular_name' => _x('News', 'post type singular name'),
|
22 |
+
'add_new' => _x('Add News Item', 'news'),
|
23 |
+
'add_new_item' => __('Add New News Item'),
|
24 |
+
'edit_item' => __('Edit News Item'),
|
25 |
+
'new_item' => __('New News Item'),
|
26 |
+
'view_item' => __('View News Item'),
|
27 |
+
'search_items' => __('Search News Items'),
|
28 |
+
'not_found' => __('No News Items found'),
|
29 |
+
'not_found_in_trash' => __('No News Items found in Trash'),
|
30 |
+
'_builtin' => false,
|
31 |
+
'parent_item_colon' => '',
|
32 |
+
'menu_name' => 'News'
|
33 |
+
);
|
34 |
+
$news_args = array(
|
35 |
+
'labels' => $news_labels,
|
36 |
+
'public' => true,
|
37 |
+
'publicly_queryable' => true,
|
38 |
+
'exclude_from_search' => false,
|
39 |
+
'show_ui' => true,
|
40 |
+
'show_in_menu' => true,
|
41 |
+
'query_var' => true,
|
42 |
+
'rewrite' => array(
|
43 |
+
'slug' => 'news',
|
44 |
+
'with_front' => false
|
45 |
+
),
|
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('category', 'post_tag')
|
53 |
+
);
|
54 |
+
register_post_type('news',$news_args);
|
55 |
+
}
|
56 |
+
|
57 |
+
function my_rewrite_flush() {
|
58 |
+
sp_cpt_news_init();
|
59 |
+
flush_rewrite_rules();
|
60 |
+
}
|
61 |
+
register_activation_hook( __FILE__, 'my_rewrite_flush' );
|
62 |
+
add_action( 'wp_enqueue_scripts','style_css_script' );
|
63 |
+
function style_css_script() {
|
64 |
+
wp_enqueue_style( 'cssnews', plugin_dir_url( __FILE__ ). 'css/stylenews.css' );
|
65 |
+
wp_enqueue_script( 'vticker', plugin_dir_url( __FILE__ ) . 'js/jcarousellite.js', array( 'jquery' ));
|
66 |
+
}
|
67 |
+
class SP_News_Widget extends WP_Widget {
|
68 |
+
|
69 |
+
function SP_News_Widget() {
|
70 |
+
|
71 |
+
$widget_ops = array('classname' => 'SP_News_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar', 'news_cpt') );
|
72 |
+
$control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_widget' );
|
73 |
+
$this->WP_Widget( 'sp_news_widget', __('Letest News Widget', 'news_cpt'), $widget_ops, $control_ops );
|
74 |
+
}
|
75 |
+
|
76 |
+
function form($instance) {
|
77 |
+
$instance = wp_parse_args((array) $instance, array( 'title' => '' ));
|
78 |
+
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
79 |
+
$num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
|
80 |
+
?>
|
81 |
+
<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>
|
82 |
+
<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>
|
83 |
+
<?php
|
84 |
+
}
|
85 |
+
|
86 |
+
function update($new_instance, $old_instance) {
|
87 |
+
$instance = $old_instance;
|
88 |
+
$instance['title'] = $new_instance['title'];
|
89 |
+
$instance['num_items'] = $new_instance['num_items'];
|
90 |
+
return $instance;
|
91 |
+
}
|
92 |
+
function widget($news_args, $instance) {
|
93 |
+
extract($news_args, EXTR_SKIP);
|
94 |
+
|
95 |
+
$current_post_name = get_query_var('name');
|
96 |
+
|
97 |
+
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
98 |
+
$num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
|
99 |
+
|
100 |
+
$postcount = 0;
|
101 |
+
|
102 |
+
echo $before_widget;
|
103 |
+
|
104 |
+
?>
|
105 |
+
<h4 class="sp_new_title"><?php echo $title ?></h4>
|
106 |
+
<!--visual-columns-->
|
107 |
+
<div class="recent-news-items">
|
108 |
+
<ul>
|
109 |
+
<?php // setup the query
|
110 |
+
$news_args = array( 'suppress_filters' => true,
|
111 |
+
'posts_per_page' => $num_items,
|
112 |
+
'post_type' => 'news',
|
113 |
+
'order' => 'DESC'
|
114 |
+
);
|
115 |
+
|
116 |
+
$cust_loop = new WP_Query($news_args);
|
117 |
+
if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
|
118 |
+
?>
|
119 |
+
<li>
|
120 |
+
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
|
121 |
+
|
122 |
+
</li>
|
123 |
+
<?php endwhile;
|
124 |
+
endif;
|
125 |
+
wp_reset_query(); ?>
|
126 |
+
|
127 |
+
</ul>
|
128 |
+
</div>
|
129 |
+
<?php
|
130 |
+
echo $after_widget;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/* Register the widget */
|
135 |
+
function sp_news_widget_load_widgets() {
|
136 |
+
register_widget( 'SP_News_Widget' );
|
137 |
+
}
|
138 |
+
|
139 |
+
/* Load the widget */
|
140 |
+
add_action( 'widgets_init', 'sp_news_widget_load_widgets' );
|
141 |
+
|
142 |
+
/* scrolling news */
|
143 |
+
class SP_News_scrolling_Widget extends WP_Widget {
|
144 |
+
|
145 |
+
function SP_News_scrolling_Widget() {
|
146 |
+
|
147 |
+
$widget_ops = array('classname' => 'SP_News_scrolling_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar', 'news_cpt') );
|
148 |
+
$control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_s_widget' );
|
149 |
+
$this->WP_Widget( 'sp_news_s_widget', __('Letest News Scrolling Widget', 'news_cpt'), $widget_ops, $control_ops );
|
150 |
+
}
|
151 |
+
|
152 |
+
function form($instance) {
|
153 |
+
$instance = wp_parse_args((array) $instance, array( 'title' => '' ));
|
154 |
+
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
155 |
+
$num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
|
156 |
+
?>
|
157 |
+
<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>
|
158 |
+
<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>
|
159 |
+
<?php
|
160 |
+
}
|
161 |
+
|
162 |
+
function update($new_instance, $old_instance) {
|
163 |
+
$instance = $old_instance;
|
164 |
+
$instance['title'] = $new_instance['title'];
|
165 |
+
$instance['num_items'] = $new_instance['num_items'];
|
166 |
+
return $instance;
|
167 |
+
}
|
168 |
+
function widget($news_args, $instance) {
|
169 |
+
extract($news_args, EXTR_SKIP);
|
170 |
+
$current_post_name = get_query_var('name');
|
171 |
+
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
172 |
+
$num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
|
173 |
+
$postcount = 0;
|
174 |
+
|
175 |
+
echo $before_widget;
|
176 |
+
|
177 |
+
?>
|
178 |
+
<h4 class="sp_new_title"><?php echo $title ?></h4>
|
179 |
+
<!--visual-columns-->
|
180 |
+
<div class="recent-news-items">
|
181 |
+
<div class="newsticker-jcarousellite">
|
182 |
+
<ul>
|
183 |
+
<?php // setup the query
|
184 |
+
$news_args = array( 'suppress_filters' => true,
|
185 |
+
'posts_per_page' => $num_items,
|
186 |
+
'post_type' => 'news',
|
187 |
+
'order' => 'DESC'
|
188 |
+
);
|
189 |
+
|
190 |
+
$cust_loop = new WP_Query($news_args);
|
191 |
+
if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
|
192 |
+
?>
|
193 |
+
<li >
|
194 |
+
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
|
195 |
+
</li>
|
196 |
+
<?php endwhile;
|
197 |
+
endif;
|
198 |
+
wp_reset_query(); ?>
|
199 |
+
</ul>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
<?php
|
203 |
+
echo $after_widget;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/* Register the widget */
|
208 |
+
function sp_news_scroll_widget_load_widgets() {
|
209 |
+
register_widget( 'SP_News_scrolling_Widget' );
|
210 |
+
}
|
211 |
+
|
212 |
+
/* Load the widget */
|
213 |
+
add_action( 'widgets_init', 'sp_news_scroll_widget_load_widgets' );
|
214 |
+
|
215 |
+
/* news with thumb */
|
216 |
+
class SP_News_thmb_Widget extends WP_Widget {
|
217 |
+
|
218 |
+
function SP_News_thmb_Widget() {
|
219 |
+
|
220 |
+
$widget_ops = array('classname' => 'SP_News_thmb_Widget', 'description' => __('Displayed Letest News Items from the News in a sidebar with thumbnails', 'news_cpt') );
|
221 |
+
$control_ops = array( 'width' => 350, 'height' => 450, 'id_base' => 'sp_news_sthumb_widget' );
|
222 |
+
$this->WP_Widget( 'sp_news_sthumb_widget', __('Letest News with thumb Widget', 'news_cpt'), $widget_ops, $control_ops );
|
223 |
+
}
|
224 |
+
|
225 |
+
function form($instance) {
|
226 |
+
$instance = wp_parse_args((array) $instance, array( 'title' => '' ));
|
227 |
+
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
228 |
+
$num_items = isset($instance['num_items']) ? absint($instance['num_items']) : 5;
|
229 |
+
?>
|
230 |
+
<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>
|
231 |
+
<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>
|
232 |
+
<?php
|
233 |
+
}
|
234 |
+
|
235 |
+
function update($new_instance, $old_instance) {
|
236 |
+
$instance = $old_instance;
|
237 |
+
$instance['title'] = $new_instance['title'];
|
238 |
+
$instance['num_items'] = $new_instance['num_items'];
|
239 |
+
return $instance;
|
240 |
+
}
|
241 |
+
function widget($news_args, $instance) {
|
242 |
+
extract($news_args, EXTR_SKIP);
|
243 |
+
|
244 |
+
$current_post_name = get_query_var('name');
|
245 |
+
|
246 |
+
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
247 |
+
$num_items = empty($instance['num_items']) ? '5' : apply_filters('widget_title', $instance['num_items']);
|
248 |
+
|
249 |
+
$postcount = 0;
|
250 |
+
|
251 |
+
echo $before_widget;
|
252 |
+
|
253 |
+
?>
|
254 |
+
<h4 class="sp_new_title"><?php echo $title ?></h4>
|
255 |
+
<!--visual-columns-->
|
256 |
+
<div class="recent-news-items">
|
257 |
+
<div class="newstickerthumb-jcarousellite">
|
258 |
+
<ul>
|
259 |
+
<?php // setup the query
|
260 |
+
$news_args = array( 'suppress_filters' => true,
|
261 |
+
'posts_per_page' => $num_items,
|
262 |
+
'post_type' => 'news',
|
263 |
+
'order' => 'DESC'
|
264 |
+
);
|
265 |
+
|
266 |
+
$cust_loop = new WP_Query($news_args);
|
267 |
+
if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
|
268 |
+
?>
|
269 |
+
<li>
|
270 |
+
<div class="news_thumb_left">
|
271 |
+
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php
|
272 |
+
if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
|
273 |
+
the_post_thumbnail( array(80,80) );
|
274 |
+
}
|
275 |
+
?> </a></div>
|
276 |
+
<div class="news_thumb_right">
|
277 |
+
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
|
278 |
+
</div>
|
279 |
+
</li>
|
280 |
+
<?php endwhile;
|
281 |
+
endif;
|
282 |
+
wp_reset_query(); ?>
|
283 |
+
|
284 |
+
</ul>
|
285 |
+
</div> </div>
|
286 |
+
<?php
|
287 |
+
echo $after_widget;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
/* Register the widget */
|
291 |
+
function sp_news_thumb_widget_load_widgets() {
|
292 |
+
register_widget( 'SP_News_thmb_Widget' );
|
293 |
+
}
|
294 |
+
|
295 |
+
/* Load the widget */
|
296 |
+
add_action( 'widgets_init', 'sp_news_thumb_widget_load_widgets' );
|
297 |
+
|
298 |
+
|
299 |
+
function get_news( $atts, $content = null ){
|
300 |
+
// setup the query
|
301 |
+
extract(shortcode_atts(array(
|
302 |
+
"limit" => '',
|
303 |
+
"category" => '',
|
304 |
+
"grid" => ''
|
305 |
+
), $atts));
|
306 |
+
// Define limit
|
307 |
+
if( $limit ) {
|
308 |
+
$posts_per_page = $limit;
|
309 |
+
} else {
|
310 |
+
$posts_per_page = '-1';
|
311 |
+
}
|
312 |
+
if( $category ) {
|
313 |
+
$cat = $category;
|
314 |
+
} else {
|
315 |
+
$cat = '';
|
316 |
+
}
|
317 |
+
if( $grid ) {
|
318 |
+
$gridcol = $grid;
|
319 |
+
} else {
|
320 |
+
$gridcol = '1';
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
ob_start();
|
325 |
+
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
|
326 |
+
|
327 |
+
$post_type = 'news';
|
328 |
+
$orderby = 'post_date';
|
329 |
+
$order = 'DESC';
|
330 |
+
|
331 |
+
query_posts( array (
|
332 |
+
'post_type' => $post_type,
|
333 |
+
'orderby' => $orderby,
|
334 |
+
'order' => $order,
|
335 |
+
'posts_per_page' => $posts_per_page,
|
336 |
+
'cat' => $cat,
|
337 |
+
'paged' => $paged,
|
338 |
+
)
|
339 |
+
);
|
340 |
+
|
341 |
+
|
342 |
+
if (have_posts()) :
|
343 |
+
while (have_posts()) : the_post(); ?>
|
344 |
+
|
345 |
+
<div id="post-<?php the_ID(); ?>" class="news type-news news-col-<?php echo $gridcol; ?>">
|
346 |
+
<div class="news-thumb">
|
347 |
+
<?php
|
348 |
+
// Post thumbnail.
|
349 |
+
if ( has_post_thumbnail() && $gridcol == '1') { // check if the post has a Post Thumbnail assigned to it.
|
350 |
+
the_post_thumbnail('url');
|
351 |
+
} else if($gridcol > '2') { ?>
|
352 |
+
<div class="grid-news-thumb">
|
353 |
+
<?php the_post_thumbnail('thumbnail'); ?>
|
354 |
+
</div>
|
355 |
+
<?php } else { ?>
|
356 |
+
<div class="grid-news-thumb">
|
357 |
+
<?php the_post_thumbnail('medium'); ?>
|
358 |
+
</div>
|
359 |
+
<?php } ?>
|
360 |
+
</div>
|
361 |
+
<div class="news-content">
|
362 |
+
<?php if($gridcol == '1') { ?>
|
363 |
+
<div class="date-post">
|
364 |
+
<h2><span><?php echo get_the_date('j'); ?></span></h2>
|
365 |
+
<p><?php echo get_the_date('M y'); ?></p>
|
366 |
+
</div>
|
367 |
+
<?php } else { ?>
|
368 |
+
<div class="grid-date-post">
|
369 |
+
<?php echo get_the_date('j, M y'); ?>
|
370 |
+
</div>
|
371 |
+
<?php } ?>
|
372 |
+
<div class="post-content-text">
|
373 |
+
<?php the_title( sprintf( '<h2 class="news-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
|
374 |
+
|
375 |
+
|
376 |
+
<div class="news-content-excerpt">
|
377 |
+
<?php The_excerpt(); ?>
|
378 |
+
|
379 |
+
</div><!-- .entry-content -->
|
380 |
+
</div>
|
381 |
+
</div>
|
382 |
+
</div><!-- #post-## -->
|
383 |
+
<?php endwhile;
|
384 |
+
endif; ?>
|
385 |
+
<div class="news_pagination">
|
386 |
+
|
387 |
+
<div class="button-news-p"><?php previous_posts_link( '<< Previous' ); ?></div>
|
388 |
+
<div class="button-news-n"><?php next_posts_link( 'Next >>' ); ?> </div>
|
389 |
+
</div>
|
390 |
+
<?php
|
391 |
+
wp_reset_query();
|
392 |
+
|
393 |
+
return ob_get_clean();
|
394 |
+
}
|
395 |
+
add_shortcode('sp_news','get_news');
|
396 |
+
|
397 |
+
function mynewsscript() {
|
398 |
+
$option = 'NewsWidget_option';
|
399 |
+
$newsscrollingoptionadmin = get_option( $option, $default );
|
400 |
+
$customscrollpost = $newsscrollingoptionadmin['news_width'];
|
401 |
+
$customscrollpostheight = $newsscrollingoptionadmin['news_height'];
|
402 |
+
$customscrollpostdelay = $newsscrollingoptionadmin['news_delay'];
|
403 |
+
$customscrollpostspeed = $newsscrollingoptionadmin['news_speed'];
|
404 |
+
|
405 |
+
if ($customscrollpost == 0 )
|
406 |
+
{
|
407 |
+
$vtrue = 'true';
|
408 |
+
} else { $vtrue = 'false';
|
409 |
+
}
|
410 |
+
if ($customscrollpostheight == '' )
|
411 |
+
{
|
412 |
+
$vvisible = 3;
|
413 |
+
} else { $vvisible = $customscrollpostheight;
|
414 |
+
}
|
415 |
+
if ($customscrollpostdelay == '' )
|
416 |
+
{
|
417 |
+
$vdelay = 500;
|
418 |
+
} else { $vdelay = $customscrollpostdelay;
|
419 |
+
}
|
420 |
+
if ($customscrollpostspeed == '' )
|
421 |
+
{
|
422 |
+
$vspeed = 2000;
|
423 |
+
} else { $vspeed = $customscrollpostspeed;
|
424 |
+
}
|
425 |
+
?>
|
426 |
+
<script type="text/javascript">
|
427 |
+
|
428 |
+
jQuery(function() {
|
429 |
+
jQuery(".newsticker-jcarousellite").jCarouselLite({
|
430 |
+
vertical: <?php echo $vtrue; ?>,
|
431 |
+
hoverPause:true,
|
432 |
+
visible: <?php echo $vvisible; ?>,
|
433 |
+
auto: <?php echo $vdelay; ?>,
|
434 |
+
speed:<?php echo $vspeed; ?>,
|
435 |
+
|
436 |
+
});
|
437 |
+
jQuery(".newstickerthumb-jcarousellite").jCarouselLite({
|
438 |
+
vertical: <?php echo $vtrue; ?>,
|
439 |
+
hoverPause:true,
|
440 |
+
visible: <?php echo $vvisible; ?>,
|
441 |
+
auto: <?php echo $vdelay; ?>,
|
442 |
+
speed:<?php echo $vspeed; ?>,
|
443 |
+
});
|
444 |
+
});
|
445 |
+
</script>
|
446 |
+
<?php
|
447 |
+
}
|
448 |
+
add_action('wp_head', 'mynewsscript');
|
449 |
+
|
450 |
+
class SP_News_setting
|
451 |
+
{
|
452 |
+
/**
|
453 |
+
* Holds the values to be used in the fields callbacks
|
454 |
+
*/
|
455 |
+
private $options;
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Start up
|
459 |
+
*/
|
460 |
+
public function __construct()
|
461 |
+
{
|
462 |
+
add_action( 'admin_menu', array( $this, 'add_news_page' ) );
|
463 |
+
add_action( 'admin_init', array( $this, 'page_init_news' ) );
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Add options page
|
468 |
+
*/
|
469 |
+
public function add_news_page()
|
470 |
+
{
|
471 |
+
// This page will be under "Settings"
|
472 |
+
add_options_page(
|
473 |
+
'Settings Admin',
|
474 |
+
'News Widget Settings',
|
475 |
+
'manage_options',
|
476 |
+
'news-setting-admin',
|
477 |
+
array( $this, 'create_newsadmin_page' )
|
478 |
+
);
|
479 |
+
}
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Options page callback
|
483 |
+
*/
|
484 |
+
public function create_newsadmin_page()
|
485 |
+
{
|
486 |
+
// Set class property
|
487 |
+
$this->options = get_option( 'NewsWidget_option' );
|
488 |
+
?>
|
489 |
+
<div class="wrap">
|
490 |
+
<?php screen_icon(); ?>
|
491 |
+
<h2>Scrolling News Widget Setting</h2>
|
492 |
+
<form method="post" action="options.php">
|
493 |
+
<?php
|
494 |
+
// This prints out all hidden setting fields
|
495 |
+
settings_fields( 'news_option_group' );
|
496 |
+
do_settings_sections( 'news-setting-admin' );
|
497 |
+
submit_button();
|
498 |
+
?>
|
499 |
+
</form>
|
500 |
+
</div>
|
501 |
+
<?php
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Register and add settings
|
506 |
+
*/
|
507 |
+
public function page_init_news()
|
508 |
+
{
|
509 |
+
register_setting(
|
510 |
+
'news_option_group', // Option group
|
511 |
+
'NewsWidget_option', // Option name
|
512 |
+
array( $this, 'sanitize' ) // Sanitize
|
513 |
+
);
|
514 |
+
|
515 |
+
add_settings_section(
|
516 |
+
'setting_section_id', // ID
|
517 |
+
'Scorlling News Widget Settings', // Title
|
518 |
+
array( $this, 'print_section_info' ), // Callback
|
519 |
+
'news-setting-admin' // Page
|
520 |
+
);
|
521 |
+
|
522 |
+
add_settings_field(
|
523 |
+
'news_width', // ID
|
524 |
+
'Widget Scrolling Direction (Vertical OR Horizontal) ', // Title
|
525 |
+
array( $this, 'news_width_callback' ), // Callback
|
526 |
+
'news-setting-admin', // Page
|
527 |
+
'setting_section_id' // Section
|
528 |
+
);
|
529 |
+
|
530 |
+
add_settings_field(
|
531 |
+
'news_height',
|
532 |
+
'Number of news visible at a time',
|
533 |
+
array( $this, 'news_height_callback' ),
|
534 |
+
'news-setting-admin',
|
535 |
+
'setting_section_id'
|
536 |
+
);
|
537 |
+
add_settings_field(
|
538 |
+
'news_delay', // ID
|
539 |
+
'Enter delay ', // Title
|
540 |
+
array( $this, 'news_delay_callback' ), // Callback
|
541 |
+
'news-setting-admin', // Page
|
542 |
+
'setting_section_id' // Section
|
543 |
+
);
|
544 |
+
|
545 |
+
add_settings_field(
|
546 |
+
'news_speed',
|
547 |
+
'Enter speed',
|
548 |
+
array( $this, 'news_speed_callback' ),
|
549 |
+
'news-setting-admin',
|
550 |
+
'setting_section_id'
|
551 |
+
);
|
552 |
+
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Sanitize each setting field as needed
|
557 |
+
*
|
558 |
+
* @param array $input Contains all settings fields as array keys
|
559 |
+
*/
|
560 |
+
public function sanitize( $input )
|
561 |
+
{
|
562 |
+
$new_input = array();
|
563 |
+
if( isset( $input['news_width'] ) )
|
564 |
+
$new_input['news_width'] = sanitize_text_field( $input['news_width'] );
|
565 |
+
|
566 |
+
if( isset( $input['news_height'] ) )
|
567 |
+
$new_input['news_height'] = sanitize_text_field( $input['news_height'] );
|
568 |
+
|
569 |
+
if( isset( $input['news_delay'] ) )
|
570 |
+
$new_input['news_delay'] = sanitize_text_field( $input['news_delay'] );
|
571 |
+
|
572 |
+
if( isset( $input['news_speed'] ) )
|
573 |
+
$new_input['news_speed'] = sanitize_text_field( $input['news_speed'] );
|
574 |
+
|
575 |
+
return $new_input;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Print the Section text
|
580 |
+
*/
|
581 |
+
public function print_section_info()
|
582 |
+
{
|
583 |
+
print 'Enter your settings below:';
|
584 |
+
}
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Get the settings option array and print one of its values
|
588 |
+
*/
|
589 |
+
public function news_width_callback()
|
590 |
+
{
|
591 |
+
printf(
|
592 |
+
'<input type="text" id="news_width" name="NewsWidget_option[news_width]" value="%s" />',
|
593 |
+
isset( $this->options['news_width'] ) ? esc_attr( $this->options['news_width']) : ''
|
594 |
+
);
|
595 |
+
printf(' Enter "0" for <b>Vertical Scrolling</b> and "1" for <b>Horizontal Scrolling</b>');
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Get the settings option array and print one of its values
|
600 |
+
*/
|
601 |
+
public function news_height_callback()
|
602 |
+
{
|
603 |
+
printf(
|
604 |
+
'<input type="text" id="news_height" name="NewsWidget_option[news_height]" value="%s" />',
|
605 |
+
isset( $this->options['news_height'] ) ? esc_attr( $this->options['news_height']) : ''
|
606 |
+
);
|
607 |
+
printf(' ie 1, 2, 3, 4 etc');
|
608 |
+
}
|
609 |
+
public function news_delay_callback()
|
610 |
+
{
|
611 |
+
printf(
|
612 |
+
'<input type="text" id="news_delay" name="NewsWidget_option[news_delay]" value="%s" />',
|
613 |
+
isset( $this->options['news_delay'] ) ? esc_attr( $this->options['news_delay']) : ''
|
614 |
+
);
|
615 |
+
printf(' ie 500, 1000 milliseconds delay');
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Get the settings option array and print one of its values
|
620 |
+
*/
|
621 |
+
public function news_speed_callback()
|
622 |
+
{
|
623 |
+
printf(
|
624 |
+
'<input type="text" id="news_speed" name="NewsWidget_option[news_speed]" value="%s" />',
|
625 |
+
isset( $this->options['news_speed'] ) ? esc_attr( $this->options['news_speed']) : ''
|
626 |
+
);
|
627 |
+
printf(' ie 500, 1000 milliseconds speed');
|
628 |
+
}
|
629 |
+
}
|
630 |
+
|
631 |
+
if( is_admin() )
|
632 |
+
$my_newssettings_page = new SP_News_setting();
|
633 |
+
?>
|