Version Description
Download this release
Release Info
Developer | cbaldelomar |
Plugin | Shortcodes by Angie Makes |
Version | 3.26 |
Comparing to | |
See all releases |
Code changes from version 3.24 to 3.26
- README.md +9 -0
- admin/assets/css/wcvisualmanager.css +6 -0
- admin/assets/css/wpc-image.css +19 -0
- admin/assets/js/shortcodes-tinymce-4.js +7 -0
- admin/assets/js/wpc-image.js +199 -0
- admin/class-admin.php +11 -0
- admin/class-ajax.php +4 -0
- public/assets/css/style.css +135 -0
- public/class-register.php +151 -0
- public/class-sanitize.php +144 -0
- public/class-vars.php +53 -1
- public/class-widget-options.php +18 -0
- public/class-widgets.php +2 -0
- public/templates/featured/content.php +27 -0
- public/widgets/widget-featured-posts.php +172 -0
- public/widgets/widget-heading.php +4 -3
- public/widgets/widget-image-links.php +117 -0
- public/widgets/widget-post-slider.php +2 -2
- public/widgets/widget-posts.php +1 -1
- public/widgets/widget-social-icons.php +3 -0
- readme.txt +9 -0
- wc-shortcodes.php +1 -1
README.md
CHANGED
@@ -106,6 +106,15 @@ See our help article on [how to manually upload a plugin](http://knowledgebase.a
|
|
106 |
|
107 |
## Changelog ##
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
### Version 3.24 ###
|
110 |
|
111 |
* smoother masonry loading
|
106 |
|
107 |
## Changelog ##
|
108 |
|
109 |
+
### Version 3.26 ###
|
110 |
+
|
111 |
+
* Added featured posts widget
|
112 |
+
|
113 |
+
### Version 3.25 ###
|
114 |
+
|
115 |
+
* added image links shortcode and widget
|
116 |
+
* added max height rule when default is set.
|
117 |
+
|
118 |
### Version 3.24 ###
|
119 |
|
120 |
* smoother masonry loading
|
admin/assets/css/wcvisualmanager.css
CHANGED
@@ -39,16 +39,19 @@
|
|
39 |
}
|
40 |
/**/
|
41 |
html .wc-shortcodes-visual-manager,
|
|
|
42 |
html .wc-shortcodes-visual-manager.ui-accordion {
|
43 |
margin-bottom: 1.5em;
|
44 |
}
|
45 |
html .wc-shortcodes-visual-manager .ui-autocomplete,
|
|
|
46 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-autocomplete {
|
47 |
z-index: 999999;
|
48 |
max-height: 300px;
|
49 |
overflow: auto;
|
50 |
}
|
51 |
html .wc-shortcodes-visual-manager .ui-autocomplete li,
|
|
|
52 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-autocomplete li {
|
53 |
white-space: normal;
|
54 |
}
|
@@ -62,6 +65,7 @@ html .wc-shortcodes-visual-manager .wc-shortcodes-widget-fa .ui-autocomplete li
|
|
62 |
html .wc-shortcodes-visual-manager .wc-shortcodes-widget-fa .ui-autocomplete li span {
|
63 |
line-height: 2;
|
64 |
}
|
|
|
65 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header {
|
66 |
border: 1px solid #ddd;
|
67 |
position: relative;
|
@@ -78,6 +82,7 @@ html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header {
|
|
78 |
font-weight: 600;
|
79 |
margin-top: 1em;
|
80 |
}
|
|
|
81 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header:before {
|
82 |
content: "\f345";
|
83 |
border: none;
|
@@ -98,6 +103,7 @@ html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header:before {
|
|
98 |
vertical-align: bottom;
|
99 |
margin-right: 5px;
|
100 |
}
|
|
|
101 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header.ui-accordion-header-active:before {
|
102 |
content: "\f347";
|
103 |
}
|
39 |
}
|
40 |
/**/
|
41 |
html .wc-shortcodes-visual-manager,
|
42 |
+
html .wc-shortcodes-visual-manager .ui-accordion,
|
43 |
html .wc-shortcodes-visual-manager.ui-accordion {
|
44 |
margin-bottom: 1.5em;
|
45 |
}
|
46 |
html .wc-shortcodes-visual-manager .ui-autocomplete,
|
47 |
+
html .wc-shortcodes-visual-manager .ui-accordion .ui-autocomplete,
|
48 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-autocomplete {
|
49 |
z-index: 999999;
|
50 |
max-height: 300px;
|
51 |
overflow: auto;
|
52 |
}
|
53 |
html .wc-shortcodes-visual-manager .ui-autocomplete li,
|
54 |
+
html .wc-shortcodes-visual-manager .ui-accordion .ui-autocomplete li,
|
55 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-autocomplete li {
|
56 |
white-space: normal;
|
57 |
}
|
65 |
html .wc-shortcodes-visual-manager .wc-shortcodes-widget-fa .ui-autocomplete li span {
|
66 |
line-height: 2;
|
67 |
}
|
68 |
+
html .wc-shortcodes-visual-manager .ui-accordion .ui-accordion-header,
|
69 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header {
|
70 |
border: 1px solid #ddd;
|
71 |
position: relative;
|
82 |
font-weight: 600;
|
83 |
margin-top: 1em;
|
84 |
}
|
85 |
+
html .wc-shortcodes-visual-manager .ui-accordion .ui-accordion-header:before,
|
86 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header:before {
|
87 |
content: "\f345";
|
88 |
border: none;
|
103 |
vertical-align: bottom;
|
104 |
margin-right: 5px;
|
105 |
}
|
106 |
+
html .wc-shortcodes-visual-manager .ui-accordion .ui-accordion-header.ui-accordion-header-active:before,
|
107 |
html .wc-shortcodes-visual-manager.ui-accordion .ui-accordion-header.ui-accordion-header-active:before {
|
108 |
content: "\f347";
|
109 |
}
|
admin/assets/css/wpc-image.css
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wpc-image-wrapper .wpc-widgets-preview-image img {
|
2 |
+
max-height: 200px;
|
3 |
+
background: #fafafa;
|
4 |
+
padding: 0;
|
5 |
+
border-width: 0;
|
6 |
+
max-width: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.wpc-image-wrapper .wpc-widgets-preview-image {
|
10 |
+
margin-bottom: 5px;
|
11 |
+
}
|
12 |
+
|
13 |
+
.wpc-image-wrapper .wpc-widgets-image-field {
|
14 |
+
margin: 1em 0;
|
15 |
+
}
|
16 |
+
.wpc-image-wrapper .wpc-widgets-image-field .button,
|
17 |
+
.wpc-image-wrapper .wpc-widgets-image-field input {
|
18 |
+
margin-bottom: 7px;
|
19 |
+
}
|
admin/assets/js/shortcodes-tinymce-4.js
CHANGED
@@ -216,6 +216,13 @@
|
|
216 |
wcShortcodes( shortcode, editor );
|
217 |
}
|
218 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
{
|
220 |
text: "Box",
|
221 |
onclick: function(){
|
216 |
wcShortcodes( shortcode, editor );
|
217 |
}
|
218 |
},
|
219 |
+
{
|
220 |
+
text: "Image Links",
|
221 |
+
onclick: function(){
|
222 |
+
var shortcode = '[wc_image_links image_1="" text_1="" url_1="" image_2="" text_2="" url_2="" image_3="" text_3="" url_3="" image_4="" text_4="" url_4="" text_position="center" heading_type="h3" height="250px" class=""][/wc_image_links]';
|
223 |
+
wcShortcodes( shortcode, editor );
|
224 |
+
}
|
225 |
+
},
|
226 |
{
|
227 |
text: "Box",
|
228 |
onclick: function(){
|
admin/assets/js/wpc-image.js
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @author Chris Baldelomar
|
3 |
+
* @website http://webplantmedia.com/
|
4 |
+
*/
|
5 |
+
(function($) {
|
6 |
+
"use strict";
|
7 |
+
|
8 |
+
var $body = $("body"), file_frame = [], media = wp.media;
|
9 |
+
|
10 |
+
//fetch preExisting selection of galleries. change the gallery state based on wheter we got a selection or not to "Edit gallery" or "AAdd gallery"
|
11 |
+
var fetchSelection = function(ids, options) {
|
12 |
+
if(typeof ids === 'undefined') {
|
13 |
+
return; //<--happens on multi_image insert for modal group
|
14 |
+
}
|
15 |
+
|
16 |
+
var id_array = ids.split(','),
|
17 |
+
args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in:id_array},
|
18 |
+
attachments = wp.media.query( args ),
|
19 |
+
selection = new wp.media.model.Selection( attachments.models, {
|
20 |
+
props: attachments.props.toJSON(),
|
21 |
+
multiple: true
|
22 |
+
});
|
23 |
+
|
24 |
+
|
25 |
+
if(options.state === 'gallery-library' && id_array.length && !isNaN(parseInt(id_array[0],10))) {
|
26 |
+
options.state = 'gallery-edit';
|
27 |
+
}
|
28 |
+
return selection;
|
29 |
+
};
|
30 |
+
|
31 |
+
$body.on('click', '.wpc-widgets-image-upload', function( event ) {
|
32 |
+
event.preventDefault();
|
33 |
+
|
34 |
+
var clicked = $(this),
|
35 |
+
options = clicked.data(),
|
36 |
+
parent = clicked.parent(),
|
37 |
+
target = parent.find(options.target),
|
38 |
+
preview = parent.find(options.preview), // will not find <div> tag inside of <p>
|
39 |
+
prefill = fetchSelection(target.val(), options),
|
40 |
+
frame_key = _.random(0, 999999999999999999);
|
41 |
+
//set vars so we know that an editor is open
|
42 |
+
|
43 |
+
// If the media frame already exists, reopen it.
|
44 |
+
if ( file_frame[frame_key] ) {
|
45 |
+
file_frame[frame_key].open();
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
// Create the media frame.
|
50 |
+
file_frame[frame_key] = wp.media({
|
51 |
+
frame: options.frame,
|
52 |
+
state: options.state,
|
53 |
+
library: { type: 'image' },
|
54 |
+
button: { text: options.button },
|
55 |
+
className: options['class'],
|
56 |
+
selection: prefill
|
57 |
+
});
|
58 |
+
|
59 |
+
if ( 'wpc_widgets_insert_single' === options.state ) {
|
60 |
+
// add the single insert state
|
61 |
+
file_frame[frame_key].states.add([
|
62 |
+
// Main states.
|
63 |
+
new media.controller.Library({
|
64 |
+
id: 'wpc_widgets_insert_single',
|
65 |
+
title: clicked.data( 'title' ),
|
66 |
+
priority: 20,
|
67 |
+
toolbar: 'select',
|
68 |
+
filterable: 'uploaded',
|
69 |
+
library: media.query( file_frame[frame_key].options.library ),
|
70 |
+
multiple: false,
|
71 |
+
editable: true,
|
72 |
+
displayUserSettings: false,
|
73 |
+
displaySettings: true,
|
74 |
+
allowLocalEdits: true
|
75 |
+
// AttachmentView: media.view.Attachment.Library
|
76 |
+
})
|
77 |
+
]);
|
78 |
+
}
|
79 |
+
else if ( 'wpc_widgets_insert_multi' === options.state ) {
|
80 |
+
// add the single insert state
|
81 |
+
file_frame[frame_key].states.add([
|
82 |
+
new media.controller.Library({
|
83 |
+
id: 'wpc_widgets_insert_multi',
|
84 |
+
title: clicked.data( 'title' ),
|
85 |
+
priority: 20,
|
86 |
+
toolbar: 'select',
|
87 |
+
filterable: 'uploaded',
|
88 |
+
library: media.query( file_frame[frame_key].options.library ),
|
89 |
+
multiple: 'add',
|
90 |
+
editable: true,
|
91 |
+
displayUserSettings: false,
|
92 |
+
displaySettings: false,
|
93 |
+
allowLocalEdits: true
|
94 |
+
// AttachmentView: media.view.Attachment.Library
|
95 |
+
})
|
96 |
+
]);
|
97 |
+
}
|
98 |
+
|
99 |
+
// When an image is selected, run a callback.
|
100 |
+
// Bind to various events since single insert and multiple trigger on different events and work with different data
|
101 |
+
file_frame[frame_key].on( 'select update insert', function(e) {
|
102 |
+
var selection, state = file_frame[frame_key].state();
|
103 |
+
|
104 |
+
// multiple items
|
105 |
+
if(typeof e !== 'undefined') {
|
106 |
+
selection = e;
|
107 |
+
}
|
108 |
+
// single item
|
109 |
+
else {
|
110 |
+
selection = state.get('selection');
|
111 |
+
}
|
112 |
+
|
113 |
+
var values , display, element, preview_html= "", preview_img;
|
114 |
+
|
115 |
+
values = selection.map( function( attachment ) {
|
116 |
+
element = attachment.toJSON();
|
117 |
+
|
118 |
+
if ( 'url' === options.fetch ) {
|
119 |
+
display = state.display( attachment ).toJSON();
|
120 |
+
|
121 |
+
if ( 'undefined' === typeof element.sizes ) {
|
122 |
+
preview_img = element.url;
|
123 |
+
preview_html += "<img src='"+preview_img+"' />";
|
124 |
+
}
|
125 |
+
else if ( ( 'string' === typeof options.imgsize ) && ( 'object' === typeof element.sizes[ options.imgsize ] ) ) {
|
126 |
+
preview_img = element.sizes[ options.imgsize ].url;
|
127 |
+
preview_html += "<img src='"+preview_img+"' />";
|
128 |
+
}
|
129 |
+
else {
|
130 |
+
preview_img = element.sizes[display.size].url;
|
131 |
+
preview_html += "<img src='"+preview_img+"' />";
|
132 |
+
}
|
133 |
+
|
134 |
+
return preview_img;
|
135 |
+
}
|
136 |
+
else if(options.fetch === 'id') {
|
137 |
+
preview_img = typeof element.sizes.thumbnail !== 'undefined' ? element.sizes.thumbnail.url : element.url ;
|
138 |
+
preview_html += "<img src='"+preview_img+"' />";
|
139 |
+
|
140 |
+
return element[options.fetch];
|
141 |
+
}
|
142 |
+
else {
|
143 |
+
return element.url;
|
144 |
+
}
|
145 |
+
});
|
146 |
+
|
147 |
+
if ( target.length ) {
|
148 |
+
target.val( values.join(',') ).trigger('change');
|
149 |
+
|
150 |
+
// triggers change in customizer
|
151 |
+
target.keyup();
|
152 |
+
}
|
153 |
+
|
154 |
+
if ( preview.length ) {
|
155 |
+
preview.html( preview_html ).show();
|
156 |
+
}
|
157 |
+
});
|
158 |
+
|
159 |
+
// Finally, open the modal
|
160 |
+
file_frame[frame_key].open();
|
161 |
+
})
|
162 |
+
.on('click', '.wpc-widgets-restore-image', function( e ) {
|
163 |
+
e.preventDefault();
|
164 |
+
|
165 |
+
var clicked = $(this),
|
166 |
+
options = clicked.data(),
|
167 |
+
parent = clicked.parent(),
|
168 |
+
target = parent.find(options.target),
|
169 |
+
preview = parent.find(options.preview);
|
170 |
+
|
171 |
+
$(target).val(options.restore);
|
172 |
+
|
173 |
+
if ( preview.length && options.restore.length ) {
|
174 |
+
$(preview).html('<img src="'+options.restore+'" />').show();
|
175 |
+
}
|
176 |
+
else {
|
177 |
+
$(preview).html("").hide();
|
178 |
+
}
|
179 |
+
|
180 |
+
$(target).keyup();
|
181 |
+
})
|
182 |
+
.on('click', '.wpc-widgets-delete-image', function( e ) {
|
183 |
+
e.preventDefault();
|
184 |
+
|
185 |
+
var clicked = $(this),
|
186 |
+
options = clicked.data(),
|
187 |
+
parent = clicked.parent(),
|
188 |
+
target = parent.find(options.target),
|
189 |
+
preview = parent.find(options.preview);
|
190 |
+
|
191 |
+
$(target).val('');
|
192 |
+
|
193 |
+
if ( preview.length ) {
|
194 |
+
$(preview).html("").hide();
|
195 |
+
}
|
196 |
+
|
197 |
+
$(target).keyup();
|
198 |
+
});
|
199 |
+
})(jQuery);
|
admin/class-admin.php
CHANGED
@@ -77,6 +77,17 @@ class WPC_Shortcodes_Admin extends WPC_Shortcodes_Vars {
|
|
77 |
wp_enqueue_style( 'wp-color-picker' );
|
78 |
wp_enqueue_script( 'wc-shortcodes-color-picker-widget', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wccolorpickerwidget.js', array ( 'wp-color-picker' ), $ver, true );
|
79 |
wp_enqueue_script( 'wc-shortcodes', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wc-shortcodes.js', array ( 'jquery' ), $ver, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
|
77 |
wp_enqueue_style( 'wp-color-picker' );
|
78 |
wp_enqueue_script( 'wc-shortcodes-color-picker-widget', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wccolorpickerwidget.js', array ( 'wp-color-picker' ), $ver, true );
|
79 |
wp_enqueue_script( 'wc-shortcodes', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wc-shortcodes.js', array ( 'jquery' ), $ver, true );
|
80 |
+
|
81 |
+
wp_deregister_style( 'wpc-widgets-admin-style' );
|
82 |
+
wp_deregister_script( 'wpc-widgets-admin-js' );
|
83 |
+
|
84 |
+
wp_register_style( 'wpc-widgets-admin-style', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/css/wpc-image.css', array(), $ver, 'all' );
|
85 |
+
wp_enqueue_style( 'wpc-widgets-admin-style' );
|
86 |
+
|
87 |
+
wp_enqueue_media();
|
88 |
+
wp_register_script( 'wpc-widgets-admin-js', WC_SHORTCODES_PLUGIN_URL . 'admin/assets/js/wpc-image.js', array ( 'jquery' ), $ver, true );
|
89 |
+
wp_enqueue_script( 'wpc-widgets-admin-js' );
|
90 |
+
|
91 |
}
|
92 |
|
93 |
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
|
admin/class-ajax.php
CHANGED
@@ -241,6 +241,10 @@ class WPC_Shortcodes_Ajax {
|
|
241 |
$widget = new WPC_Shortcodes_Widget_Image();
|
242 |
$widget->form( $attr );
|
243 |
break;
|
|
|
|
|
|
|
|
|
244 |
case 'wc_fa' :
|
245 |
$widget = new WPC_Shortcodes_Widget_FA();
|
246 |
$widget->form( $attr );
|
241 |
$widget = new WPC_Shortcodes_Widget_Image();
|
242 |
$widget->form( $attr );
|
243 |
break;
|
244 |
+
case 'wc_image_links' :
|
245 |
+
$widget = new WPC_Shortcodes_Widget_Image_Links();
|
246 |
+
$widget->form( $attr );
|
247 |
+
break;
|
248 |
case 'wc_fa' :
|
249 |
$widget = new WPC_Shortcodes_Widget_FA();
|
250 |
$widget->form( $attr );
|
public/assets/css/style.css
CHANGED
@@ -790,6 +790,7 @@
|
|
790 |
.wc-shortcodes-social-icons li i.fa-youtube { background-color: #c74a00; }
|
791 |
.wc-shortcodes-social-icons li i.fa-tumblr { background-color: #426b8a; }
|
792 |
|
|
|
793 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-10 img { max-height: 10px; }
|
794 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-12 img { max-height: 12px; }
|
795 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-14 img { max-height: 14px; }
|
@@ -2051,3 +2052,137 @@ pre.pre-wrap {
|
|
2051 |
background-color: #f7f7f7;
|
2052 |
visibility: visible;
|
2053 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
790 |
.wc-shortcodes-social-icons li i.fa-youtube { background-color: #c74a00; }
|
791 |
.wc-shortcodes-social-icons li i.fa-tumblr { background-color: #426b8a; }
|
792 |
|
793 |
+
.wc-shortcodes-social-icons.wc-shortcodes-maxheight- img { max-height: none; }
|
794 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-10 img { max-height: 10px; }
|
795 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-12 img { max-height: 12px; }
|
796 |
.wc-shortcodes-social-icons.wc-shortcodes-maxheight-14 img { max-height: 14px; }
|
2052 |
background-color: #f7f7f7;
|
2053 |
visibility: visible;
|
2054 |
}
|
2055 |
+
/**
|
2056 |
+
* [wc_image_links]
|
2057 |
+
* ----------------------------------------------------------------------------
|
2058 |
+
*/
|
2059 |
+
.wc-shortcodes-image-links-wrapper {
|
2060 |
+
overflow: hidden;
|
2061 |
+
}
|
2062 |
+
.wc-shortcodes-image-links-wrapper-inner {
|
2063 |
+
margin-right: -2em;
|
2064 |
+
display: block;
|
2065 |
+
}
|
2066 |
+
.wc-shortcodes-image-link {
|
2067 |
+
display: block;
|
2068 |
+
float: left;
|
2069 |
+
}
|
2070 |
+
.wc-shortcodes-image-link-columns-1 .wc-shortcodes-image-link {
|
2071 |
+
width: 100%;
|
2072 |
+
}
|
2073 |
+
.wc-shortcodes-image-link-columns-2 .wc-shortcodes-image-link {
|
2074 |
+
width: 50%;
|
2075 |
+
}
|
2076 |
+
.wc-shortcodes-image-link-columns-3 .wc-shortcodes-image-link {
|
2077 |
+
width: 33.333333%;
|
2078 |
+
}
|
2079 |
+
.wc-shortcodes-image-link-columns-4 .wc-shortcodes-image-link {
|
2080 |
+
width: 25%;
|
2081 |
+
}
|
2082 |
+
.wc-shortcodes-image-link-background-wrapper {
|
2083 |
+
margin-right: 2em;
|
2084 |
+
}
|
2085 |
+
.wc-shortcodes-image-link-background {
|
2086 |
+
background-size: cover;
|
2087 |
+
background-repeat: no-repeat;
|
2088 |
+
background-position: center center;
|
2089 |
+
position: relative;
|
2090 |
+
}
|
2091 |
+
.wc-shortcodes-image-link-text {
|
2092 |
+
text-align: center;
|
2093 |
+
display: block;
|
2094 |
+
width: 100%;
|
2095 |
+
position: absolute;
|
2096 |
+
top: 0;
|
2097 |
+
}
|
2098 |
+
.wc-shortcodes-image-link-text-position-center .wc-shortcodes-image-link-text {
|
2099 |
+
top: 50%;
|
2100 |
+
bottom: auto;
|
2101 |
+
-webkit-transform: translateY(-50%);
|
2102 |
+
-ms-transform: translateY(-50%);
|
2103 |
+
transform: translateY(-50%);
|
2104 |
+
}
|
2105 |
+
.wc-shortcodes-image-link-text-position-bottom .wc-shortcodes-image-link-text {
|
2106 |
+
top: auto;
|
2107 |
+
bottom: 0;
|
2108 |
+
}
|
2109 |
+
.wc-shortcodes-image-link-text-position-under .wc-shortcodes-image-link-text {
|
2110 |
+
top: auto;
|
2111 |
+
bottom: auto;
|
2112 |
+
position: relative;
|
2113 |
+
}
|
2114 |
+
.wc-shortcodes-image-link-text-position-under .wc-shortcodes-image-link-text .wc-shortcodes-image-links-heading {
|
2115 |
+
}
|
2116 |
+
#wc-shortcodes-image-links .wc-shortcodes-image-links-heading {
|
2117 |
+
margin: 0;
|
2118 |
+
padding: 0.7em 1em;
|
2119 |
+
display: inline-block;
|
2120 |
+
background-color: #ffffff;
|
2121 |
+
color: #000000;
|
2122 |
+
}
|
2123 |
+
@media (max-width: 767px) {
|
2124 |
+
#wc-shortcodes-image-links .wc-shortcodes-image-link {
|
2125 |
+
width: 100%;
|
2126 |
+
}
|
2127 |
+
#wc-shortcodes-image-links .wc-shortcodes-image-link-background-wrapper {
|
2128 |
+
margin-right: 0;
|
2129 |
+
margin-bottom: 2em;
|
2130 |
+
}
|
2131 |
+
#wc-shortcodes-image-links .wc-shortcodes-image-links-wrapper-inner {
|
2132 |
+
margin-right: 0;
|
2133 |
+
}
|
2134 |
+
}
|
2135 |
+
/**
|
2136 |
+
* [wc_featured_posts]
|
2137 |
+
* ----------------------------------------------------------------------------
|
2138 |
+
*/
|
2139 |
+
.wc-shortcodes-featured-posts-content-inner {
|
2140 |
+
overflow: hidden;
|
2141 |
+
}
|
2142 |
+
.wc-shortcodes-featured-posts-content {
|
2143 |
+
margin-bottom: 2.3em;
|
2144 |
+
}
|
2145 |
+
.wc-shortcodes-featured-posts-content:last-child {
|
2146 |
+
margin-bottom: 0;
|
2147 |
+
}
|
2148 |
+
.wc-shortcodes-featured-posts-layout-thumbnail .wcs-fp-post-thumbnail {
|
2149 |
+
width: 100px;
|
2150 |
+
height: 100px;
|
2151 |
+
background-repeat: no-repeat;
|
2152 |
+
background-position: center center;
|
2153 |
+
background-size: cover;
|
2154 |
+
float: left;
|
2155 |
+
}
|
2156 |
+
.wc-shortcodes-featured-posts-layout-thumbnail .wcs-fp-post-content.wcs-fp-has-post-thumbnail {
|
2157 |
+
padding-left: 1em;
|
2158 |
+
overflow: hidden;
|
2159 |
+
}
|
2160 |
+
.wc-shortcodes-featured-posts .wcs-fp-title {
|
2161 |
+
clear: none;
|
2162 |
+
}
|
2163 |
+
#wc-shortcodes-featured-posts #wc-shortcodes-featured-posts-inner .wcs-fp-title {
|
2164 |
+
margin-top: 0;
|
2165 |
+
margin-bottom: 0;
|
2166 |
+
}
|
2167 |
+
#wc-shortcodes-featured-posts #wc-shortcodes-featured-posts-inner .wc-shortcodes-entry-category {
|
2168 |
+
margin-top: 0;
|
2169 |
+
margin-bottom: 0.4em;
|
2170 |
+
}
|
2171 |
+
#wc-shortcodes-featured-posts .wc-shortcodes-featured-posts-layout-showcase .wcs-fp-post-thumbnail {
|
2172 |
+
margin-bottom: 0.4em;
|
2173 |
+
}
|
2174 |
+
.wc-shortcodes-featured-posts-layout-showcase .wcs-fp-post-content {
|
2175 |
+
text-align: center;
|
2176 |
+
}
|
2177 |
+
.wc-shortcodes-featured-posts-layout-showcase .wcs-fp-post-thumbnail {
|
2178 |
+
width: 100%;
|
2179 |
+
padding-bottom: 100%;
|
2180 |
+
height: 0;
|
2181 |
+
background-repeat: no-repeat;
|
2182 |
+
background-position: center center;
|
2183 |
+
background-size: cover;
|
2184 |
+
}
|
2185 |
+
.wc-shortcodes-featured-posts-layout-showcase .wcs-fp-post-thumbnail-wrapper {
|
2186 |
+
max-width: 400px;
|
2187 |
+
margin: 0 auto;
|
2188 |
+
}
|
public/class-register.php
CHANGED
@@ -32,7 +32,9 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
32 |
add_shortcode( 'wc_rsvp', array( &$this, 'rsvp' ) );
|
33 |
add_shortcode( 'wc_posts', array( &$this, 'posts' ) );
|
34 |
add_shortcode( 'wc_post_slider', array( &$this, 'post_slider' ) );
|
|
|
35 |
add_shortcode( 'wc_image', array( &$this, 'image' ) );
|
|
|
36 |
add_shortcode( 'wc_fa', array( &$this, 'fa' ) );
|
37 |
add_shortcode( 'wc_share', array( &$this, 'share_buttons' ) );
|
38 |
add_shortcode( 'wc_share_buttons', array( &$this, 'get_share_buttons' ) );
|
@@ -1354,6 +1356,110 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
1354 |
return $html;
|
1355 |
}
|
1356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1357 |
public function image( $atts ) {
|
1358 |
$atts = shortcode_atts( parent::$attr->image, $atts );
|
1359 |
$atts = WPC_Shortcodes_Sanitize::image_attr( $atts );
|
@@ -1443,6 +1549,51 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
1443 |
return $html;
|
1444 |
}
|
1445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1446 |
public function fa( $atts ) {
|
1447 |
$atts = shortcode_atts( parent::$attr->fa, $atts );
|
1448 |
$atts = WPC_Shortcodes_Sanitize::fa_attr( $atts );
|
32 |
add_shortcode( 'wc_rsvp', array( &$this, 'rsvp' ) );
|
33 |
add_shortcode( 'wc_posts', array( &$this, 'posts' ) );
|
34 |
add_shortcode( 'wc_post_slider', array( &$this, 'post_slider' ) );
|
35 |
+
add_shortcode( 'wc_featured_posts', array( &$this, 'featured_posts' ) );
|
36 |
add_shortcode( 'wc_image', array( &$this, 'image' ) );
|
37 |
+
add_shortcode( 'wc_image_links', array( &$this, 'image_links' ) );
|
38 |
add_shortcode( 'wc_fa', array( &$this, 'fa' ) );
|
39 |
add_shortcode( 'wc_share', array( &$this, 'share_buttons' ) );
|
40 |
add_shortcode( 'wc_share_buttons', array( &$this, 'get_share_buttons' ) );
|
1356 |
return $html;
|
1357 |
}
|
1358 |
|
1359 |
+
public function featured_posts( $atts ) {
|
1360 |
+
global $post;
|
1361 |
+
global $wc_shortcodes_posts_query;
|
1362 |
+
|
1363 |
+
static $instance = 0;
|
1364 |
+
$instance++;
|
1365 |
+
|
1366 |
+
$atts = shortcode_atts( parent::$attr->featured_posts, $atts );
|
1367 |
+
$atts = WPC_Shortcodes_Sanitize::featured_posts_attr( $atts );
|
1368 |
+
|
1369 |
+
// Convert comma delimeted string to array
|
1370 |
+
$p = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['pids'] );
|
1371 |
+
|
1372 |
+
$atts['p'] = '';
|
1373 |
+
$atts['post__in'] = '';
|
1374 |
+
|
1375 |
+
if ( is_array( $p ) && ! empty( $p ) ) {
|
1376 |
+
$size = sizeof( $p );
|
1377 |
+
if ( 1 < $size ) {
|
1378 |
+
$atts['post__in'] = $p;
|
1379 |
+
}
|
1380 |
+
else if ( 1 == $size ) {
|
1381 |
+
$atts['p'] = $p[0];
|
1382 |
+
}
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
$atts['terms'] = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['terms'] );
|
1386 |
+
|
1387 |
+
// Return if posts_per_page is set to 0.
|
1388 |
+
if ( 0 == $atts['posts_per_page'] ) {
|
1389 |
+
return;
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
// fix bug with title argument being added to WP_Query() in 4.4
|
1393 |
+
$display_keys = array(
|
1394 |
+
'show_meta_category', 'heading_type', 'layout', 'template', 'size', 'title',
|
1395 |
+
);
|
1396 |
+
$display = array();
|
1397 |
+
foreach ( $display_keys as $key ) {
|
1398 |
+
$display[ $key ] = $atts[ $key ];
|
1399 |
+
unset( $atts[ $key ] );
|
1400 |
+
}
|
1401 |
+
|
1402 |
+
// remove not query keys
|
1403 |
+
unset( $atts[ 'pids' ] );
|
1404 |
+
|
1405 |
+
// check for get variable
|
1406 |
+
$wpc_term = null;
|
1407 |
+
if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
|
1408 |
+
$wpc_term = $_GET['wpc_term'];
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
// add tax query if user specified
|
1412 |
+
if ( ! empty( $wpc_term ) ) {
|
1413 |
+
$atts['tax_query'] = array(
|
1414 |
+
array(
|
1415 |
+
'taxonomy' => $atts['taxonomy'],
|
1416 |
+
'field' => $atts['field'],
|
1417 |
+
'terms' => $wpc_term,
|
1418 |
+
),
|
1419 |
+
);
|
1420 |
+
}
|
1421 |
+
else if ( ! empty( $atts['terms'] ) ) {
|
1422 |
+
$atts['tax_query'] = array(
|
1423 |
+
array(
|
1424 |
+
'taxonomy' => $atts['taxonomy'],
|
1425 |
+
'field' => $atts['field'],
|
1426 |
+
'terms' => $atts['terms'],
|
1427 |
+
),
|
1428 |
+
);
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
// run query
|
1432 |
+
$wc_shortcodes_posts_query = new WP_Query($atts);
|
1433 |
+
|
1434 |
+
// display
|
1435 |
+
$html = '';
|
1436 |
+
|
1437 |
+
$class = array();
|
1438 |
+
$class[] = 'wc-shortcodes-featured-posts';
|
1439 |
+
$class[] = 'wc-shortcodes-clearfix';
|
1440 |
+
$class[] = 'wc-shortcodes-featured-posts-layout-' . $display['layout'];
|
1441 |
+
$class[] = 'wc-shortcodes-featured-posts-template-' . $display['template'];
|
1442 |
+
|
1443 |
+
$html .= '<div id="wc-shortcodes-featured-posts" class="wc-shortcodes-featured-posts-wrapper">';
|
1444 |
+
$html .= '<div id="wc-shortcodes-featured-posts-'.$instance.'" class="' . esc_attr( implode( ' ', $class ) ) . '">';
|
1445 |
+
|
1446 |
+
while( $wc_shortcodes_posts_query->have_posts() ) {
|
1447 |
+
$wc_shortcodes_posts_query->the_post();
|
1448 |
+
|
1449 |
+
ob_start();
|
1450 |
+
include('templates/featured/content.php');
|
1451 |
+
$html .= ob_get_clean();
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
$html .= '</div>';
|
1455 |
+
$html .= '</div>';
|
1456 |
+
|
1457 |
+
// reset query
|
1458 |
+
wp_reset_query();
|
1459 |
+
|
1460 |
+
return $html;
|
1461 |
+
}
|
1462 |
+
|
1463 |
public function image( $atts ) {
|
1464 |
$atts = shortcode_atts( parent::$attr->image, $atts );
|
1465 |
$atts = WPC_Shortcodes_Sanitize::image_attr( $atts );
|
1549 |
return $html;
|
1550 |
}
|
1551 |
|
1552 |
+
public function image_links( $atts ) {
|
1553 |
+
$atts = shortcode_atts( parent::$attr->image_links, $atts );
|
1554 |
+
$atts = WPC_Shortcodes_Sanitize::image_links_attr( $atts );
|
1555 |
+
|
1556 |
+
$html = '';
|
1557 |
+
$columns = 0;
|
1558 |
+
|
1559 |
+
for ( $i = 1; $i <= 4; $i++ ) {
|
1560 |
+
if ( isset( $atts['image_'.$i] ) && ! empty ( $atts['image_'.$i] ) ) {
|
1561 |
+
$columns++;
|
1562 |
+
|
1563 |
+
$style = array();
|
1564 |
+
$style[] = 'background-image:url(\''.esc_url( $atts['image_'.$i] ).'\')';
|
1565 |
+
$style[] = 'height:'.$atts['height'];
|
1566 |
+
|
1567 |
+
$text = '';
|
1568 |
+
if ( isset( $atts['text_'.$i] ) && ! empty ( $atts['text_'.$i] ) ) {
|
1569 |
+
$text = '<div class="wc-shortcodes-image-link-text"><'.$atts['heading_type'].' class="wc-shortcodes-image-links-heading">' . $atts['text_'.$i] . '</'.$atts['heading_type'].'></div>';
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
$html .= '<a class="wc-shortcodes-image-link wc-shortcodes-image-link-'.$i.'" href="' . esc_url( $atts['url_'.$i] ) . '">';
|
1573 |
+
if ( 'under' == $atts['text_position'] ) {
|
1574 |
+
$html .= '<div class="wc-shortcodes-image-link-background-wrapper"><div class="wc-shortcodes-image-link-background" style="' . implode( ';', $style ) . '"></div>' . $text . '</div>';
|
1575 |
+
}
|
1576 |
+
else {
|
1577 |
+
$html .= '<div class="wc-shortcodes-image-link-background-wrapper"><div class="wc-shortcodes-image-link-background" style="' . implode( ';', $style ) . '">' . $text . '</div></div>';
|
1578 |
+
}
|
1579 |
+
$html .= '</a>';
|
1580 |
+
}
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
if ( ! empty( $html ) ) {
|
1584 |
+
$classes = array();
|
1585 |
+
$classes[] = 'wc-shortcodes-image-links-wrapper';
|
1586 |
+
$classes[] = 'wc-shortcodes-image-link-text-position-'.$atts['text_position'];
|
1587 |
+
$classes[] = 'wc-shortcodes-image-link-columns-' . $columns;
|
1588 |
+
if ( ! empty( $atts['class'] ) ) {
|
1589 |
+
$classes = $atts['class'];
|
1590 |
+
}
|
1591 |
+
$html = '<div id="wc-shortcodes-image-links" class="'.implode( ' ', $classes ).'"><div class="wc-shortcodes-image-links-wrapper-inner">'.$html.'</div>';
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
return $html;
|
1595 |
+
}
|
1596 |
+
|
1597 |
public function fa( $atts ) {
|
1598 |
$atts = shortcode_atts( parent::$attr->fa, $atts );
|
1599 |
$atts = WPC_Shortcodes_Sanitize::fa_attr( $atts );
|
public/class-sanitize.php
CHANGED
@@ -362,6 +362,15 @@ class WPC_Shortcodes_Sanitize {
|
|
362 |
return $default;
|
363 |
}
|
364 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
public static function text_align( $value, $default = '' ) {
|
366 |
$whitelist = WPC_Shortcodes_Widget_Options::text_align_values();
|
367 |
|
@@ -784,6 +793,68 @@ class WPC_Shortcodes_Sanitize {
|
|
784 |
return $atts;
|
785 |
}
|
786 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
public static function testimonial_attr( $atts ) {
|
788 |
foreach ( $atts as $key => $value ) {
|
789 |
switch( $key ) {
|
@@ -1214,4 +1285,77 @@ class WPC_Shortcodes_Sanitize {
|
|
1214 |
|
1215 |
return $atts;
|
1216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1217 |
}
|
362 |
return $default;
|
363 |
}
|
364 |
|
365 |
+
public static function image_link_text_position_values( $value, $default = '' ) {
|
366 |
+
$whitelist = WPC_Shortcodes_Widget_Options::image_link_text_position_values();
|
367 |
+
|
368 |
+
if ( array_key_exists( $value, $whitelist ) )
|
369 |
+
return $value;
|
370 |
+
|
371 |
+
return $default;
|
372 |
+
}
|
373 |
+
|
374 |
public static function text_align( $value, $default = '' ) {
|
375 |
$whitelist = WPC_Shortcodes_Widget_Options::text_align_values();
|
376 |
|
793 |
return $atts;
|
794 |
}
|
795 |
|
796 |
+
public static function image_links_attr( $atts ) {
|
797 |
+
foreach ( $atts as $key => $value ) {
|
798 |
+
switch( $key ) {
|
799 |
+
// image 1
|
800 |
+
case 'image_1' :
|
801 |
+
$atts[ $key ] = esc_url_raw( $value );
|
802 |
+
break;
|
803 |
+
case 'text_1' :
|
804 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
805 |
+
break;
|
806 |
+
case 'url_1' :
|
807 |
+
$atts[ $key ] = esc_url_raw( $value );
|
808 |
+
break;
|
809 |
+
// image 2
|
810 |
+
case 'image_2' :
|
811 |
+
$atts[ $key ] = esc_url_raw( $value );
|
812 |
+
break;
|
813 |
+
case 'text_2' :
|
814 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
815 |
+
break;
|
816 |
+
case 'url_2' :
|
817 |
+
$atts[ $key ] = esc_url_raw( $value );
|
818 |
+
break;
|
819 |
+
// image 3
|
820 |
+
case 'image_3' :
|
821 |
+
$atts[ $key ] = esc_url_raw( $value );
|
822 |
+
break;
|
823 |
+
case 'text_3' :
|
824 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
825 |
+
break;
|
826 |
+
case 'url_3' :
|
827 |
+
$atts[ $key ] = esc_url_raw( $value );
|
828 |
+
break;
|
829 |
+
// image 4
|
830 |
+
case 'image_4' :
|
831 |
+
$atts[ $key ] = esc_url_raw( $value );
|
832 |
+
break;
|
833 |
+
case 'text_4' :
|
834 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
835 |
+
break;
|
836 |
+
case 'url_4' :
|
837 |
+
$atts[ $key ] = esc_url_raw( $value );
|
838 |
+
break;
|
839 |
+
// Settings
|
840 |
+
case 'text_position' :
|
841 |
+
$atts[ $key ] = self::image_link_text_position_values( $value );
|
842 |
+
break;
|
843 |
+
case 'height' :
|
844 |
+
$atts[ $key ] = self::css_unit( $value );
|
845 |
+
break;
|
846 |
+
case 'heading_type' :
|
847 |
+
$atts[ $key ] = self::heading_type( $value );
|
848 |
+
break;
|
849 |
+
case 'class' :
|
850 |
+
$atts[ $key ] = self::html_classes( $value );
|
851 |
+
break;
|
852 |
+
}
|
853 |
+
}
|
854 |
+
|
855 |
+
return $atts;
|
856 |
+
}
|
857 |
+
|
858 |
public static function testimonial_attr( $atts ) {
|
859 |
foreach ( $atts as $key => $value ) {
|
860 |
switch( $key ) {
|
1285 |
|
1286 |
return $atts;
|
1287 |
}
|
1288 |
+
|
1289 |
+
// Fixes bools on widget update when checkbox is empty, and thus blank. We don't want to revert to the default value, but false.
|
1290 |
+
public static function featured_posts_attr_fix_bools( $atts ) {
|
1291 |
+
$bools = array( 'ignore_sticky_posts', 'show_meta_category', 'nopaging' );
|
1292 |
+
|
1293 |
+
foreach ( $bools as $key ) {
|
1294 |
+
if ( ! isset( $atts[ $key ] ) ) {
|
1295 |
+
$atts[ $key ] = 0;
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
return $atts;
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
public static function featured_posts_attr( $atts ) {
|
1303 |
+
// sanitize bools
|
1304 |
+
$bools = array( 'ignore_sticky_posts', 'show_meta_category', 'nopaging' );
|
1305 |
+
|
1306 |
+
foreach ( $bools as $key ) {
|
1307 |
+
if ( isset( $atts[ $key ] ) ) {
|
1308 |
+
if ( "no" == $atts[ $key ] ) {
|
1309 |
+
$atts[ $key ] = 0;
|
1310 |
+
}
|
1311 |
+
else {
|
1312 |
+
$atts[ $key ] = (bool) $atts[ $key ];
|
1313 |
+
$atts[ $key ] = $atts[ $key ] ? 1 : 0;
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
$atts['nopaging'] = (bool) $atts['nopaging'];
|
1319 |
+
|
1320 |
+
// sanitize ints
|
1321 |
+
$ints = array( 'p', 'posts_per_page', 'heading_size');
|
1322 |
+
foreach ( $ints as $key ) {
|
1323 |
+
if ( isset( $atts[ $key ] ) ) {
|
1324 |
+
$atts[ $key ] = (int) $atts[ $key ];
|
1325 |
+
}
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
// sanitize limit
|
1329 |
+
$atts['nopaging'] = false;
|
1330 |
+
if ( $atts['posts_per_page'] <= 0 ) {
|
1331 |
+
$atts['posts_per_page'] = 1;
|
1332 |
+
}
|
1333 |
+
if ( $atts['posts_per_page'] >= 10 ) {
|
1334 |
+
$atts['posts_per_page'] = 10;
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
// sanitize dropdown
|
1338 |
+
$valid_layouts = WPC_Shortcodes_Widget_Options::featured_post_layouts();
|
1339 |
+
if ( ! array_key_exists( $atts['layout'], $valid_layouts ) ) {
|
1340 |
+
$atts['layout'] = 'thumbnail';
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
$valid_orders = WPC_Shortcodes_Widget_Options::order_fields();
|
1344 |
+
$atts['order'] = strtoupper( $atts['order'] );
|
1345 |
+
if ( ! in_array( $atts['order'], $valid_orders ) ) {
|
1346 |
+
$atts['order'] = 'DESC';
|
1347 |
+
}
|
1348 |
+
|
1349 |
+
$atts['heading_type'] = strtolower( $atts['heading_type'] );
|
1350 |
+
$valid_headings = WPC_Shortcodes_Widget_Options::heading_tags();
|
1351 |
+
$atts['heading_type'] = in_array( $atts['heading_type'], $valid_headings ) ? $atts['heading_type'] : 'h2';
|
1352 |
+
|
1353 |
+
// sanitize inputs
|
1354 |
+
$atts['title'] = sanitize_text_field( $atts['title'] );
|
1355 |
+
$atts['terms'] = sanitize_text_field( $atts['terms'] );
|
1356 |
+
$atts['pids'] = sanitize_text_field( $atts['pids'] );
|
1357 |
+
$atts['post__in'] = sanitize_text_field( $atts['post__in'] );
|
1358 |
+
|
1359 |
+
return $atts;
|
1360 |
+
}
|
1361 |
}
|
public/class-vars.php
CHANGED
@@ -8,7 +8,7 @@ class WPC_Shortcodes_Vars {
|
|
8 |
*
|
9 |
* @var string
|
10 |
*/
|
11 |
-
const VERSION = '3.
|
12 |
const DB_VERSION = '1.0';
|
13 |
|
14 |
/**
|
@@ -323,6 +323,29 @@ class WPC_Shortcodes_Vars {
|
|
323 |
// misc options
|
324 |
'class' => '',
|
325 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
self::$attr->countdown = array(
|
327 |
'date' => '',
|
328 |
'format' => 'wdHMs',
|
@@ -448,5 +471,34 @@ class WPC_Shortcodes_Vars {
|
|
448 |
'slider_pause' => 4000,
|
449 |
'slider_auto' => 0,
|
450 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
}
|
452 |
}
|
8 |
*
|
9 |
* @var string
|
10 |
*/
|
11 |
+
const VERSION = '3.26';
|
12 |
const DB_VERSION = '1.0';
|
13 |
|
14 |
/**
|
323 |
// misc options
|
324 |
'class' => '',
|
325 |
);
|
326 |
+
self::$attr->image_links = array(
|
327 |
+
// image 1
|
328 |
+
'image_1' => '',
|
329 |
+
'text_1' => '',
|
330 |
+
'url_1' => '',
|
331 |
+
// image 2
|
332 |
+
'image_2' => '',
|
333 |
+
'text_2' => '',
|
334 |
+
'url_2' => '',
|
335 |
+
// image 3
|
336 |
+
'image_3' => '',
|
337 |
+
'text_3' => '',
|
338 |
+
'url_3' => '',
|
339 |
+
// image 4
|
340 |
+
'image_4' => '',
|
341 |
+
'text_4' => '',
|
342 |
+
'url_4' => '',
|
343 |
+
// settings
|
344 |
+
'text_position' => 'center',
|
345 |
+
'heading_type' => 'h3',
|
346 |
+
'height' => '250px',
|
347 |
+
'class' => '',
|
348 |
+
);
|
349 |
self::$attr->countdown = array(
|
350 |
'date' => '',
|
351 |
'format' => 'wdHMs',
|
471 |
'slider_pause' => 4000,
|
472 |
'slider_auto' => 0,
|
473 |
);
|
474 |
+
self::$attr->featured_posts = array(
|
475 |
+
'title' => '', //use author id
|
476 |
+
'author' => '', //use author id
|
477 |
+
'author_name' => '', //use 'user_nicename' (NOT name).
|
478 |
+
'pids' => '', //use post id.
|
479 |
+
'p' => '', //use post id.
|
480 |
+
'post__in' => '', //use post ids
|
481 |
+
'order' => 'DESC', // DESC, ASC
|
482 |
+
'orderby' => 'date',
|
483 |
+
'post_status' => 'publish',
|
484 |
+
'post_type' => 'post', // post, page, wc_portfolio_item, etc
|
485 |
+
'posts_per_page' => 4, //number of post to show per page
|
486 |
+
'nopaging' => false, //show all posts or use pagination. Default value is 'false', use paging.
|
487 |
+
'ignore_sticky_posts' => 1,
|
488 |
+
|
489 |
+
'taxonomy' => '', // category, post_tag, wc_portfolio_tag, etc
|
490 |
+
'field' => 'slug', // slug or id
|
491 |
+
'terms' => '', // taxonomy terms.
|
492 |
+
|
493 |
+
'show_meta_category' => 1, // show heading?
|
494 |
+
'show_content' => 0, // show main content?
|
495 |
+
|
496 |
+
'size' => 'medium', // default thumbnail size
|
497 |
+
|
498 |
+
'heading_type' => 'h2', // heading tag for title
|
499 |
+
'layout' => 'thumbnail',
|
500 |
+
'template' => 'featured',
|
501 |
+
'excerpt_length' => 20,
|
502 |
+
);
|
503 |
}
|
504 |
}
|
public/class-widget-options.php
CHANGED
@@ -11,6 +11,8 @@ class WPC_Shortcodes_Widget_Options {
|
|
11 |
'h4' => 'h4',
|
12 |
'h5' => 'h5',
|
13 |
'h6' => 'h6',
|
|
|
|
|
14 |
);
|
15 |
}
|
16 |
|
@@ -53,6 +55,13 @@ class WPC_Shortcodes_Widget_Options {
|
|
53 |
);
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
public static function post_slider_templates() {
|
57 |
return array(
|
58 |
'slider1' => 'Slider 1',
|
@@ -253,6 +262,15 @@ class WPC_Shortcodes_Widget_Options {
|
|
253 |
);
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
public static function text_align_values() {
|
257 |
return array(
|
258 |
'' => 'None',
|
11 |
'h4' => 'h4',
|
12 |
'h5' => 'h5',
|
13 |
'h6' => 'h6',
|
14 |
+
'p' => 'p',
|
15 |
+
'span' => 'span',
|
16 |
);
|
17 |
}
|
18 |
|
55 |
);
|
56 |
}
|
57 |
|
58 |
+
public static function featured_post_layouts() {
|
59 |
+
return array(
|
60 |
+
'thumbnail' => 'Thumbnail',
|
61 |
+
'showcase' => 'Showcase',
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
public static function post_slider_templates() {
|
66 |
return array(
|
67 |
'slider1' => 'Slider 1',
|
262 |
);
|
263 |
}
|
264 |
|
265 |
+
public static function image_link_text_position_values() {
|
266 |
+
return array(
|
267 |
+
'top' => 'Top',
|
268 |
+
'center' => 'Center',
|
269 |
+
'bottom' => 'Bottom',
|
270 |
+
'under' => 'Under',
|
271 |
+
);
|
272 |
+
}
|
273 |
+
|
274 |
public static function text_align_values() {
|
275 |
return array(
|
276 |
'' => 'None',
|
public/class-widgets.php
CHANGED
@@ -34,5 +34,7 @@ class WPC_Shortcodes_Widgets extends WPC_Shortcodes_Vars {
|
|
34 |
public function register_widgets() {
|
35 |
register_widget( 'WPC_Shortcodes_Widget_Social_Icons' );
|
36 |
register_widget( 'WPC_Shortcodes_Widget_Post_Slider' );
|
|
|
|
|
37 |
}
|
38 |
}
|
34 |
public function register_widgets() {
|
35 |
register_widget( 'WPC_Shortcodes_Widget_Social_Icons' );
|
36 |
register_widget( 'WPC_Shortcodes_Widget_Post_Slider' );
|
37 |
+
register_widget( 'WPC_Shortcodes_Widget_Image_Links' );
|
38 |
+
register_widget( 'WPC_Shortcodes_Widget_Featured_Posts' );
|
39 |
}
|
40 |
}
|
public/templates/featured/content.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="featured-post-<?php the_ID(); ?>" class="wc-shortcodes-featured-posts-content">
|
2 |
+
<div id="wc-shortcodes-featured-posts-inner" class="wc-shortcodes-featured-posts-content-inner">
|
3 |
+
<?php $class = ''; ?>
|
4 |
+
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
|
5 |
+
<?php $image_style = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $display['size'] ); ?>
|
6 |
+
<?php $image_style = 'background-image:url(\''.$image_style[0].'\');'; ?>
|
7 |
+
|
8 |
+
<div class="wcs-fp-post-thumbnail-wrapper">
|
9 |
+
<a href="<?php the_permalink(); ?>"><div class="wcs-fp-post-thumbnail" style="<?php echo $image_style; ?>"></div></a>
|
10 |
+
</div>
|
11 |
+
|
12 |
+
<?php $class = ' wcs-fp-has-post-thumbnail'; ?>
|
13 |
+
<?php endif; ?>
|
14 |
+
|
15 |
+
<div class="wcs-fp-post-content<?php echo $class; ?>">
|
16 |
+
<?php if ( $display['show_meta_category'] ) : ?>
|
17 |
+
<?php echo wc_shortcodes_get_posted_category(); ?>
|
18 |
+
<?php endif; ?>
|
19 |
+
|
20 |
+
<div class="wcs-fp-post-header">
|
21 |
+
<<?php echo $display['heading_type']; ?> class="wcs-fp-title">
|
22 |
+
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
|
23 |
+
</<?php echo $display['heading_type']; ?>>
|
24 |
+
</div><!-- .entry-header -->
|
25 |
+
</div>
|
26 |
+
</div><!-- .wc-shortcodes-post-border -->
|
27 |
+
</div><!-- #post -->
|
public/widgets/widget-featured-posts.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @uses WP
|
4 |
+
* @uses _Widget
|
5 |
+
*/
|
6 |
+
class WPC_Shortcodes_Widget_Featured_Posts extends WP_Widget {
|
7 |
+
function __construct() {
|
8 |
+
|
9 |
+
$widget_ops = array( 'description' => __('Add featured posts to your widget.') );
|
10 |
+
parent::__construct( 'wc_shortcodes_featured_posts', __('Angie Makes - Featured Posts'), $widget_ops );
|
11 |
+
}
|
12 |
+
|
13 |
+
function widget($args, $instance) {
|
14 |
+
$instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
15 |
+
|
16 |
+
$shortcode = array();
|
17 |
+
foreach ( $instance as $key => $value ) {
|
18 |
+
if ( 'title' == $key ) {
|
19 |
+
continue;
|
20 |
+
}
|
21 |
+
$shortcode[] = $key . '="' . $value . '"';
|
22 |
+
}
|
23 |
+
|
24 |
+
if ( ! empty( $shortcode ) ) {
|
25 |
+
$shortcode = implode( " ", $shortcode );
|
26 |
+
$shortcode = '[wc_featured_posts ' . $shortcode . '][/wc_featured_posts]';
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
$shortcode = '[wc_featured_posts][/wc_featured_posts]';
|
30 |
+
}
|
31 |
+
|
32 |
+
echo $args['before_widget'];
|
33 |
+
|
34 |
+
if ( !empty($instance['title']) )
|
35 |
+
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
36 |
+
|
37 |
+
echo do_shortcode( $shortcode );
|
38 |
+
echo $args['after_widget'];
|
39 |
+
}
|
40 |
+
|
41 |
+
function update( $new_instance, $old_instance ) {
|
42 |
+
$new_instance = WPC_Shortcodes_Sanitize::featured_posts_attr_fix_bools( $new_instance );
|
43 |
+
$instance = WPC_Shortcodes_Sanitize::featured_posts_attr( $new_instance );
|
44 |
+
|
45 |
+
return $instance;
|
46 |
+
}
|
47 |
+
|
48 |
+
function form( $instance ) {
|
49 |
+
// array_merge needs both values to be array.
|
50 |
+
if ( ! is_array( $instance ) ) {
|
51 |
+
$instance = array();
|
52 |
+
}
|
53 |
+
|
54 |
+
$o = array_merge( WPC_Shortcodes_Vars::$attr->featured_posts, $instance );
|
55 |
+
$o = WPC_Shortcodes_Sanitize::featured_posts_attr( $o );
|
56 |
+
|
57 |
+
$post_types = WPC_Shortcodes_Widget_Options::post_types();
|
58 |
+
?>
|
59 |
+
|
60 |
+
<div id="wc-shortcodes-featured-posts-widget-<?php echo $this->number; ?>" class="wc-shortcodes-featured-posts-widget wc-shortcodes-visual-manager">
|
61 |
+
<?php if ( ! isset( $o['wc_shortcodes_using_visual_manager'] ) ) : ?>
|
62 |
+
<p>
|
63 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
|
64 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $o['title']; ?>" />
|
65 |
+
</p>
|
66 |
+
<?php endif; ?>
|
67 |
+
|
68 |
+
<div class="wpc-ui-theme-override">
|
69 |
+
<h3>Select Posts</h3>
|
70 |
+
<div>
|
71 |
+
<p>
|
72 |
+
<label for="<?php echo $this->get_field_id('pids'); ?>"><?php _e('Post IDs:') ?></label>
|
73 |
+
<input type="text" class="wc-shortcodes-widget-option widefat wc-shortcodes-widget-autocomplete-select" id="<?php echo $this->get_field_id('pids'); ?>" data-autocomplete-type="multi" data-autocomplete-lookup="post" name="<?php echo $this->get_field_name('pids'); ?>" value="<?php echo $o['pids']; ?>" />
|
74 |
+
<span class="wcs-description">Leave blank to display all posts.</span>
|
75 |
+
</p>
|
76 |
+
<p>
|
77 |
+
<label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order:'); ?></label>
|
78 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
|
79 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::order_fields() as $key => $value ) : ?>
|
80 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['order'], $key ); ?>><?php echo $value; ?></option>';
|
81 |
+
<?php endforeach; ?>
|
82 |
+
</select>
|
83 |
+
</p>
|
84 |
+
<p>
|
85 |
+
<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order By:'); ?></label>
|
86 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
|
87 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::order_by_fields() as $key => $value ) : ?>
|
88 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['orderby'], $key ); ?>><?php echo $value; ?></option>';
|
89 |
+
<?php endforeach; ?>
|
90 |
+
</select>
|
91 |
+
</p>
|
92 |
+
<p>
|
93 |
+
<label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:'); ?></label>
|
94 |
+
<select id="<?php echo $this->get_field_id('post_type'); ?>" class="wc-shortcodes-widget-option wc-shortcodes-widget-post-type-selector" name="<?php echo $this->get_field_name('post_type'); ?>">
|
95 |
+
<?php foreach ( $post_types as $key => $value ) : ?>
|
96 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['post_type'], $key ); ?>><?php echo $value; ?></option>';
|
97 |
+
<?php endforeach; ?>
|
98 |
+
</select>
|
99 |
+
</p>
|
100 |
+
<p>
|
101 |
+
<label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:'); ?></label>
|
102 |
+
<select id="<?php echo $this->get_field_id('taxonomy'); ?>" class="wc-shortcodes-widget-option wc-shortcodes-widget-taxonomy-selector" name="<?php echo $this->get_field_name('taxonomy'); ?>">
|
103 |
+
<option value=""<?php selected( $o['taxonomy'], "" ); ?>>No Taxonomy</option>';
|
104 |
+
<?php foreach ( $post_types as $post_type_name ) : ?>
|
105 |
+
<?php $taxonomies = get_object_taxonomies( $post_type_name, 'names' ); ?>
|
106 |
+
<?php if ( $taxonomies ) : ?>
|
107 |
+
<?php foreach ( $taxonomies as $key ) : ?>
|
108 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['taxonomy'], $key ); ?> data-post-type="<?php echo $post_type_name; ?>"><?php echo $key; ?></option>
|
109 |
+
<?php endforeach; ?>
|
110 |
+
<?php endif; ?>
|
111 |
+
<?php endforeach; ?>
|
112 |
+
</select>
|
113 |
+
</p>
|
114 |
+
<p>
|
115 |
+
<label for="<?php echo $this->get_field_id('terms'); ?>"><?php _e('Terms:') ?></label>
|
116 |
+
<input type="text" class="wc-shortcodes-widget-option widefat wc-shortcodes-widget-autocomplete-select" id="<?php echo $this->get_field_id('terms'); ?>" data-autocomplete-type="multi" data-autocomplete-lookup="terms" name="<?php echo $this->get_field_name('terms'); ?>" value="<?php echo $o['terms']; ?>" />
|
117 |
+
<span class="wcs-description">Leave blank to display all terms.</span>
|
118 |
+
</p>
|
119 |
+
<p>
|
120 |
+
<label for="<?php echo $this->get_field_id('posts_per_page'); ?>"><?php _e('Posts Per Page:') ?></label>
|
121 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('posts_per_page'); ?>" name="<?php echo $this->get_field_name('posts_per_page'); ?>" value="<?php echo $o['posts_per_page']; ?>" />
|
122 |
+
<span class="wcs-description">Enter -1 for unlimited posts.</span>
|
123 |
+
</p>
|
124 |
+
<p>
|
125 |
+
<input type="checkbox" class="wc-shortcodes-widget-option checkbox" id="<?php echo $this->get_field_id('ignore_sticky_posts'); ?>" name="<?php echo $this->get_field_name('ignore_sticky_posts'); ?>" value="1" <?php checked( $o['ignore_sticky_posts'], 1 ); ?> />
|
126 |
+
<label for="<?php echo $this->get_field_id('ignore_sticky_posts'); ?>"><?php _e('Ignore Sticky Posts') ?></label>
|
127 |
+
</p>
|
128 |
+
</div>
|
129 |
+
<h3>Content</h3>
|
130 |
+
<div>
|
131 |
+
<p>
|
132 |
+
<input type="checkbox" class="wc-shortcodes-widget-option checkbox" id="<?php echo $this->get_field_id('show_meta_category'); ?>" name="<?php echo $this->get_field_name('show_meta_category'); ?>" value="1" <?php checked( $o['show_meta_category'], 1 ); ?> />
|
133 |
+
<label for="<?php echo $this->get_field_id('show_meta_category'); ?>"><?php _e('Show Meta Category') ?></label>
|
134 |
+
</p>
|
135 |
+
<p>
|
136 |
+
<label for="<?php echo $this->get_field_id('size'); ?>"><?php _e('Image Size:'); ?></label>
|
137 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('size'); ?>" name="<?php echo $this->get_field_name('size'); ?>">
|
138 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::image_sizes() as $key => $value ) : ?>
|
139 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['size'], $key ); ?>><?php echo $value; ?></option>
|
140 |
+
<?php endforeach; ?>
|
141 |
+
</select>
|
142 |
+
</p>
|
143 |
+
<p>
|
144 |
+
<label for="<?php echo $this->get_field_id('heading_type'); ?>"><?php _e('Heading Type:'); ?></label>
|
145 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('heading_type'); ?>" name="<?php echo $this->get_field_name('heading_type'); ?>">
|
146 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::heading_tags() as $key => $value ) : ?>
|
147 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['heading_type'], $key ); ?>><?php echo $value; ?></option>';
|
148 |
+
<?php endforeach; ?>
|
149 |
+
</select>
|
150 |
+
</p>
|
151 |
+
<p>
|
152 |
+
<label for="<?php echo $this->get_field_id('layout'); ?>"><?php _e('Layout:'); ?></label>
|
153 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('layout'); ?>" name="<?php echo $this->get_field_name('layout'); ?>">
|
154 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::featured_post_layouts() as $key => $value ) : ?>
|
155 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['layout'], $key ); ?>><?php echo $value; ?></option>';
|
156 |
+
<?php endforeach; ?>
|
157 |
+
</select>
|
158 |
+
</p>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
|
163 |
+
<script type="text/javascript">
|
164 |
+
/* <![CDATA[ */
|
165 |
+
jQuery(document).ready(function($){
|
166 |
+
$('#wc-shortcodes-featured-posts-widget-<?php echo $this->number; ?> .wpc-ui-theme-override').accordion({heightStyle: "content", collapsible: true}).wcPostsWidget();
|
167 |
+
});
|
168 |
+
/* ]]> */
|
169 |
+
</script>
|
170 |
+
<?php
|
171 |
+
}
|
172 |
+
}
|
public/widgets/widget-heading.php
CHANGED
@@ -10,6 +10,7 @@ class WPC_Shortcodes_Widget_Heading extends WPC_Shortcodes_Widget_Base {
|
|
10 |
$instance = array();
|
11 |
}
|
12 |
|
|
|
13 |
$o = array_merge( WPC_Shortcodes_Vars::$attr->heading, $instance );
|
14 |
$o = WPC_Shortcodes_Sanitize::heading_attr( $o );
|
15 |
?>
|
@@ -20,10 +21,10 @@ class WPC_Shortcodes_Widget_Heading extends WPC_Shortcodes_Widget_Base {
|
|
20 |
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $o['title']; ?>" />
|
21 |
</p>
|
22 |
<p>
|
23 |
-
<label for="<?php echo $this->get_field_id('
|
24 |
-
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('
|
25 |
<?php foreach ( WPC_Shortcodes_Widget_Options::heading_tags() as $key => $value ) : ?>
|
26 |
-
<option value="<?php echo $key; ?>"<?php selected( $o['
|
27 |
<?php endforeach; ?>
|
28 |
</select>
|
29 |
</p>
|
10 |
$instance = array();
|
11 |
}
|
12 |
|
13 |
+
// pr(WPC_Shortcodes_Vars::$attr->heading);
|
14 |
$o = array_merge( WPC_Shortcodes_Vars::$attr->heading, $instance );
|
15 |
$o = WPC_Shortcodes_Sanitize::heading_attr( $o );
|
16 |
?>
|
21 |
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $o['title']; ?>" />
|
22 |
</p>
|
23 |
<p>
|
24 |
+
<label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Heading Type:'); ?></label>
|
25 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('type'); ?>" name="<?php echo $this->get_field_name('type'); ?>">
|
26 |
<?php foreach ( WPC_Shortcodes_Widget_Options::heading_tags() as $key => $value ) : ?>
|
27 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['type'], $key ); ?>><?php echo $value; ?></option>';
|
28 |
<?php endforeach; ?>
|
29 |
</select>
|
30 |
</p>
|
public/widgets/widget-image-links.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @uses WP
|
4 |
+
* @uses _Widget
|
5 |
+
*/
|
6 |
+
class WPC_Shortcodes_Widget_Image_Links extends WP_Widget {
|
7 |
+
function __construct() {
|
8 |
+
|
9 |
+
$widget_ops = array( 'description' => __('Add image links to your widget area.') );
|
10 |
+
parent::__construct( 'wc_shortcodes_image_links', __('Angie Makes - Image Links'), $widget_ops );
|
11 |
+
}
|
12 |
+
|
13 |
+
function widget($args, $instance) {
|
14 |
+
$shortcode = array();
|
15 |
+
foreach ( $instance as $key => $value ) {
|
16 |
+
$shortcode[] = $key . '="' . $value . '"';
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( ! empty( $shortcode ) ) {
|
20 |
+
$shortcode = implode( " ", $shortcode );
|
21 |
+
$shortcode = '[wc_image_links ' . $shortcode . '][/wc_image_links]';
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
$shortcode = '[wc_image_links][/wc_image_links]';
|
25 |
+
}
|
26 |
+
|
27 |
+
echo $args['before_widget'];
|
28 |
+
echo do_shortcode( $shortcode );
|
29 |
+
echo $args['after_widget'];
|
30 |
+
}
|
31 |
+
|
32 |
+
function update( $new_instance, $old_instance ) {
|
33 |
+
$instance = WPC_Shortcodes_Sanitize::image_links_attr( $new_instance );
|
34 |
+
|
35 |
+
return $instance;
|
36 |
+
}
|
37 |
+
|
38 |
+
function form( $instance ) {
|
39 |
+
// array_merge needs both values to be array.
|
40 |
+
if ( ! is_array( $instance ) ) {
|
41 |
+
$instance = array();
|
42 |
+
}
|
43 |
+
|
44 |
+
$o = array_merge( WPC_Shortcodes_Vars::$attr->image_links, $instance );
|
45 |
+
$o = WPC_Shortcodes_Sanitize::image_links_attr( $o );
|
46 |
+
|
47 |
+
?>
|
48 |
+
|
49 |
+
<div id="wc-shortcodes-image-links-widget-<?php echo $this->number; ?>" class="wc-shortcodes-visual-manager wpc-image-wrapper wpc-ui-theme-override">
|
50 |
+
<?php for ( $i = 1; $i <= 4; $i++ ) : ?>
|
51 |
+
<?php
|
52 |
+
$imagestyle = '';
|
53 |
+
if ( empty( $o['image_1'] ) ) {
|
54 |
+
$imagestyle = ' style="display:none"';
|
55 |
+
}
|
56 |
+
?>
|
57 |
+
<h3>Image <?php echo $i; ?></h3>
|
58 |
+
<div>
|
59 |
+
<div class="wpc-widgets-image-field">
|
60 |
+
<label for="<?php echo $this->get_field_id( 'image_'.$i ); ?>"><?php echo _e( 'Image URL:' ); ?>
|
61 |
+
<input class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id( 'image_'.$i ); ?>" name="<?php echo $this->get_field_name( 'image_'.$i ); ?>" type="text" value="<?php echo esc_url( $o['image_'.$i] ); ?>" />
|
62 |
+
</label>
|
63 |
+
<a class="wpc-widgets-image-upload button inline-button" data-target="#<?php echo $this->get_field_id( 'image_'.$i ); ?>" data-preview=".wpc-widgets-preview-image" data-frame="select" data-state="wpc_widgets_insert_single" data-fetch="url" data-title="Insert Image" data-button="Insert" data-class="media-frame wpc-widgets-custom-uploader" title="Add Media">Add Media</a>
|
64 |
+
<a class="button wpc-widgets-delete-image" data-target="#<?php echo $this->get_field_id( 'image_'.$i ); ?>" data-preview=".wpc-widgets-preview-image">Delete</a>
|
65 |
+
<div class="wpc-widgets-preview-image"<?php echo $imagestyle; ?>><img src="<?php echo esc_url($o['image_'.$i]); ?>" /></div>
|
66 |
+
</div>
|
67 |
+
<p>
|
68 |
+
<label for="<?php echo $this->get_field_id('text_'.$i); ?>"><?php _e('Text:') ?></label>
|
69 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('text_'.$i); ?>" name="<?php echo $this->get_field_name('text_'.$i); ?>" value="<?php echo $o['text_'.$i]; ?>" />
|
70 |
+
</p>
|
71 |
+
<p>
|
72 |
+
<label for="<?php echo $this->get_field_id('url_'.$i); ?>"><?php _e('URL:') ?></label>
|
73 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('url_'.$i); ?>" name="<?php echo $this->get_field_name('url_'.$i); ?>" value="<?php echo $o['url_'.$i]; ?>" />
|
74 |
+
</p>
|
75 |
+
</div>
|
76 |
+
<?php endfor; ?>
|
77 |
+
<h3>Settings</h3>
|
78 |
+
<div>
|
79 |
+
<p>
|
80 |
+
<label for="<?php echo $this->get_field_id('text_position'); ?>"><?php _e('Text Position:'); ?></label>
|
81 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('text_position'); ?>" name="<?php echo $this->get_field_name('text_position'); ?>">
|
82 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::image_link_text_position_values() as $key => $value ) : ?>
|
83 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['text_position'], $key ); ?>><?php echo $value; ?></option>';
|
84 |
+
<?php endforeach; ?>
|
85 |
+
</select>
|
86 |
+
</p>
|
87 |
+
<p>
|
88 |
+
<label for="<?php echo $this->get_field_id('heading_type'); ?>"><?php _e('Heading Type:'); ?></label>
|
89 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('heading_type'); ?>" name="<?php echo $this->get_field_name('heading_type'); ?>">
|
90 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::heading_tags() as $key => $value ) : ?>
|
91 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['heading_type'], $key ); ?>><?php echo $value; ?></option>';
|
92 |
+
<?php endforeach; ?>
|
93 |
+
</select>
|
94 |
+
</p>
|
95 |
+
<p>
|
96 |
+
<label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height:') ?></label>
|
97 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" value="<?php echo $o['height']; ?>" />
|
98 |
+
<span class="wcs-description">Enter CSS unit value.</span>
|
99 |
+
</p>
|
100 |
+
<p>
|
101 |
+
<label for="<?php echo $this->get_field_id('class'); ?>"><?php _e('Class:') ?></label>
|
102 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('class'); ?>" name="<?php echo $this->get_field_name('class'); ?>" value="<?php echo $o['class']; ?>" />
|
103 |
+
<span class="wcs-description">Enter class name for custom CSS styling.</span>
|
104 |
+
</p>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<script type="text/javascript">
|
109 |
+
/* <![CDATA[ */
|
110 |
+
jQuery(document).ready(function($){
|
111 |
+
$('#wc-shortcodes-image-links-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content", collapsible: true});
|
112 |
+
});
|
113 |
+
/* ]]> */
|
114 |
+
</script>
|
115 |
+
<?php
|
116 |
+
}
|
117 |
+
}
|
public/widgets/widget-post-slider.php
CHANGED
@@ -7,7 +7,7 @@ class WPC_Shortcodes_Widget_Post_Slider extends WP_Widget {
|
|
7 |
function __construct() {
|
8 |
|
9 |
$widget_ops = array( 'description' => __('Add a post slider to your widget area.') );
|
10 |
-
parent::__construct( 'wc_shortcodes_post_slider', __('Post Slider'), $widget_ops );
|
11 |
}
|
12 |
|
13 |
function widget($args, $instance) {
|
@@ -209,7 +209,7 @@ class WPC_Shortcodes_Widget_Post_Slider extends WP_Widget {
|
|
209 |
<script type="text/javascript">
|
210 |
/* <![CDATA[ */
|
211 |
jQuery(document).ready(function($){
|
212 |
-
$('#wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content"}).wcPostsWidget();
|
213 |
});
|
214 |
/* ]]> */
|
215 |
</script>
|
7 |
function __construct() {
|
8 |
|
9 |
$widget_ops = array( 'description' => __('Add a post slider to your widget area.') );
|
10 |
+
parent::__construct( 'wc_shortcodes_post_slider', __('Angie Makes - Post Slider'), $widget_ops );
|
11 |
}
|
12 |
|
13 |
function widget($args, $instance) {
|
209 |
<script type="text/javascript">
|
210 |
/* <![CDATA[ */
|
211 |
jQuery(document).ready(function($){
|
212 |
+
$('#wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content", collapsible: true}).wcPostsWidget();
|
213 |
});
|
214 |
/* ]]> */
|
215 |
</script>
|
public/widgets/widget-posts.php
CHANGED
@@ -180,7 +180,7 @@ class WPC_Shortcodes_Widget_Posts extends WPC_Shortcodes_Widget_Base {
|
|
180 |
<script type="text/javascript">
|
181 |
/* <![CDATA[ */
|
182 |
jQuery(document).ready(function($){
|
183 |
-
$('#wc-shortcodes-posts-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content"}).wcPostsWidget();
|
184 |
});
|
185 |
/* ]]> */
|
186 |
</script>
|
180 |
<script type="text/javascript">
|
181 |
/* <![CDATA[ */
|
182 |
jQuery(document).ready(function($){
|
183 |
+
$('#wc-shortcodes-posts-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content", collapsible: true}).wcPostsWidget();
|
184 |
});
|
185 |
/* ]]> */
|
186 |
</script>
|
public/widgets/widget-social-icons.php
CHANGED
@@ -15,6 +15,9 @@ class WPC_Shortcodes_Widget_Social_Icons extends WP_Widget {
|
|
15 |
|
16 |
$shortcode = array();
|
17 |
foreach ( $instance as $key => $value ) {
|
|
|
|
|
|
|
18 |
$shortcode[] = $key . '="' . $value . '"';
|
19 |
}
|
20 |
|
15 |
|
16 |
$shortcode = array();
|
17 |
foreach ( $instance as $key => $value ) {
|
18 |
+
if ( 'title' == $key ) {
|
19 |
+
continue;
|
20 |
+
}
|
21 |
$shortcode[] = $key . '="' . $value . '"';
|
22 |
}
|
23 |
|
readme.txt
CHANGED
@@ -113,6 +113,15 @@ See our help article on [how to manually upload a plugin](http://knowledgebase.a
|
|
113 |
|
114 |
== Changelog ==
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
= Version 3.24 =
|
117 |
|
118 |
* smoother masonry loading
|
113 |
|
114 |
== Changelog ==
|
115 |
|
116 |
+
= Version 3.26 =
|
117 |
+
|
118 |
+
* Added featured posts widget
|
119 |
+
|
120 |
+
= Version 3.25 =
|
121 |
+
|
122 |
+
* added image links shortcode and widget
|
123 |
+
* added max height rule when default is set.
|
124 |
+
|
125 |
= Version 3.24 =
|
126 |
|
127 |
* smoother masonry loading
|
wc-shortcodes.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://angiemakes.com/feminine-wordpress-blog-themes-women/
|
|
5 |
Description: A plugin that adds a useful family of shortcodes to your WordPress theme.
|
6 |
Author: Chris Baldelomar
|
7 |
Author URI: http://angiemakes.com/
|
8 |
-
Version: 3.
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
|
5 |
Description: A plugin that adds a useful family of shortcodes to your WordPress theme.
|
6 |
Author: Chris Baldelomar
|
7 |
Author URI: http://angiemakes.com/
|
8 |
+
Version: 3.26
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
|