Shortcodes by Angie Makes - Version 2.01

Version Description

Download this release

Release Info

Developer cbaldelomar
Plugin Icon wp plugin Shortcodes by Angie Makes
Version 2.01
Comparing to
See all releases

Code changes from version 1.97 to 2.01

README.md CHANGED
@@ -66,6 +66,11 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
 
69
  ### Version 1.97
70
 
71
  * updated post slider style
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 2.01
70
+
71
+ * improved post_slider shortcode
72
+ * added gui interface for post_slider shortcode
73
+
74
  ### Version 1.97
75
 
76
  * updated post slider style
includes/admin/css/wc-shortcodes.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wc-shortcode-modal {
2
+ display: none;
3
+ }
4
+ #wc-shortcode-modal .media-modal {
5
+ max-width: 500px;
6
+ margin: auto;
7
+ }
8
+ #wc-shortcode-modal .media-frame-title,
9
+ #wc-shortcode-modal .media-frame-toolbar,
10
+ #wc-shortcode-modal .media-frame-content {
11
+ left: 0;
12
+ }
13
+ #wc-shortcode-modal .media-frame-content {
14
+ padding: 20px;
15
+ }
16
+ #wc-shortcode-modal code {
17
+ white-space: pre-wrap;
18
+ }
19
+ #wc-shortcode-modal .wc-shortcodes-error-yellow {
20
+ background-color: yellow;
21
+ }
22
+ #wc-shortcode-modal .wc-shortcodes-error-red {
23
+ background-color: red;
24
+ color: white;
25
+ }
26
+ #wc-shortcode-modal.hide-insert-button .media-button-insert {
27
+ display: none;
28
+ }
29
+ .wc-shortcodes-post-slider-widget .wcs-description {
30
+ font-style: italic;
31
+ margin: 2px 0 5px;
32
+ color: #aaa;
33
+ }
includes/admin/css/wcpostsliderwidget.css ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wc-shortcodes-post-slider-widget {
2
+ margin-bottom: 1.5em;
3
+ }
4
+ .wc-shortcodes-post-slider-widget .ui-autocomplete {
5
+ z-index: 999999;
6
+ max-height: 300px;
7
+ overflow: auto;
8
+ }
9
+ .wc-shortcodes-post-slider-widget .ui-autocomplete li {
10
+ white-space: normal;
11
+ }
12
+ .wc-shortcodes-post-slider-widget .ui-accordion-header {
13
+ border: 1px solid #ddd;
14
+ position: relative;
15
+ padding: 10px 15px;
16
+ height: auto;
17
+ line-height: 30px;
18
+ overflow: hidden;
19
+ word-wrap: break-word;
20
+ background: #fafafa;
21
+ color: #23282d;
22
+ margin-bottom: 0;
23
+ cursor: pointer;
24
+ font-size: 1em;
25
+ font-weight: 600;
26
+ }
27
+ .wc-shortcodes-post-slider-widget .ui-accordion-header:before {
28
+ content: "\f345";
29
+ border: none;
30
+ background: 0 0;
31
+ font-size: 1.0em;
32
+ font-family: dashicons;
33
+ speak: none;
34
+ display: inline-block;
35
+ padding: 0;
36
+ text-indent: 0;
37
+ text-align: center;
38
+ -webkit-font-smoothing: antialiased;
39
+ -moz-osx-font-smoothing: grayscale;
40
+ text-decoration: none !important;
41
+ -webkit-border-radius: 50%;
42
+ border-radius: 50%;
43
+ text-indent: -1px;
44
+ vertical-align: bottom;
45
+ margin-right: 5px;
46
+ }
47
+ .wc-shortcodes-post-slider-widget .ui-accordion-header.ui-accordion-header-active:before {
48
+ content: "\f347";
49
+ }
includes/admin/js/wc-shortcodes.js ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ) {
2
+ "use strict";
3
+
4
+ var mceEditor, mceTag, mceShortcode;
5
+
6
+ var $body = jQuery('body');
7
+
8
+ var title = '<div class="media-frame-title"><h1></h1></div>';
9
+ var innerContent = '<div class="media-frame-content"></div>';
10
+ var insertButton = '<button type="button" class="button media-button button-primary button-large media-button-insert">Insert Shortcode</button>';
11
+ var toolbar = '<div class="media-frame-toolbar"><div class="media-toolbar"><div class="media-toolbar-secondary"></div><div class="media-toolbar-primary search-form">'+insertButton+'</div></div></div>';
12
+
13
+ var button = '<button type="button" class="button-link media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text">Close media panel</span></span></button>';
14
+ var content = '<div class="media-modal-content"><div class="media-frame mode-select wp-core-ui hide-router">'+title+innerContent+toolbar+'</div></div>';
15
+ var backdrop = '<div class="media-modal-backdrop"></div>';
16
+
17
+ $body.append('<div id="wc-shortcode-modal"><div class="media-modal wp-core-ui">'+button+content+'</div>'+backdrop+'</div>');
18
+
19
+ var $modal = $body.find('#wc-shortcode-modal');
20
+ var $title = $modal.find('.media-frame-title h1');
21
+ var $innerContent = $modal.find('.media-frame-content');
22
+ var $close = $modal.find('.media-modal-close');
23
+ var $insertButton = $modal.find('.media-button-insert');
24
+ var $insert = $modal.find('.media-button-insert');
25
+ var $backdrop = $modal.find('.media-modal-backdrop');
26
+
27
+ var close = function() {
28
+ $modal.hide();
29
+ $innerContent.html('');
30
+ }
31
+ var getNameValue = function() {
32
+ }
33
+ var insertShortcode = function() {
34
+ var data = $innerContent.serialize();
35
+ var $fields = $innerContent.find("[name^='widget-wc_shortcodes_post_slider[]']");
36
+
37
+ var values = new Array();
38
+ $.each( $fields, function( i, el ) {
39
+ var $el = $(el);
40
+ var val;
41
+ if ( $el.is(':checkbox') ) {
42
+ if ( $el.is(':checked') ) {
43
+ val = $el.val();
44
+ }
45
+ else {
46
+ val = 0;
47
+ }
48
+ }
49
+ else {
50
+ val = $el.val();
51
+ }
52
+ var key = $el.attr('name').split('][').pop();
53
+ key = key.substring( 0, key.length - 1 );
54
+ values.push( key + '="' + val + '"' );
55
+ });
56
+ console.log(values);
57
+ values = values.join(" ");
58
+
59
+ var rgxp = new RegExp("^\\["+mceTag+"\\s+.+?\\]", "g");
60
+ // console.log(rgxp);
61
+
62
+ // var shortcode = "["+mceTag+" "+values+"][/"+mceTag+"]";
63
+ var shortcode = mceShortcode.replace(rgxp,"["+mceTag+" "+values+"]");
64
+
65
+ mceEditor.insertContent(shortcode);
66
+ close();
67
+ }
68
+
69
+ var getTag = function( shortcode ) {
70
+ var tag = '', last = '';
71
+
72
+ var a = shortcode.split('][');
73
+ if ( a.length > 1 ) {
74
+ var aa = a[0].split(' ');
75
+
76
+ if ( aa.length ) {
77
+ tag = aa[0];
78
+ tag = tag.substring(1);
79
+
80
+ last = a[a.length-1];
81
+ last = last.substring(1).slice(0, -1);
82
+
83
+ if ( tag == last )
84
+ return tag;
85
+ }
86
+ }
87
+
88
+ return '';
89
+ }
90
+
91
+ $close.on('click', close);
92
+ $backdrop.on('click', close);
93
+ $insertButton.on('click', insertShortcode);
94
+
95
+ window.wcShortcodes = function(shortcode,editor) {
96
+ mceEditor = editor;
97
+ mceTag = getTag( shortcode );
98
+ mceShortcode = shortcode;
99
+ var error = shortcode;
100
+ var msg;
101
+ $modal.addClass('hide-insert-button');
102
+
103
+ if ( mceTag ) {
104
+ $title.text("["+mceTag+"]");
105
+ $modal.show();
106
+ $.post(ajaxurl, {action: 'wc_mce_popup', tag: mceTag, shortcode: shortcode}, function(result){
107
+ if ( result.length ) {
108
+ $modal.removeClass('hide-insert-button');
109
+ $innerContent.html(result);
110
+ }
111
+ else {
112
+ msg = "<h3>Not Yet Supported</h3>";
113
+ msg += "<p><code>["+mceTag+"]</code> is not yet supported by our shortcode manager.</p>";
114
+ $innerContent.html(msg);
115
+ }
116
+ });
117
+ }
118
+ else {
119
+ $title.text("[edit_selection]");
120
+ $modal.show();
121
+
122
+ if ( error.length ) {
123
+ msg = 'Shortcode Selection Not Editable';
124
+ error = error.replace(/\n/g,"##newline##");
125
+ error = error.replace(/\s/g,"<span class='wc-shortcodes-error-yellow'> </span>");
126
+ error = error.replace(/##newline##/g,"<span class='wc-shortcodes-error-red'>\\n</span>");
127
+ $innerContent.html("<h3>"+msg+"</h3><p><code style='padding-left:0;padding-right:0'>"+error+"</code></p>");
128
+ }
129
+ else {
130
+ msg = 'No Selection Found';
131
+ error = 'Please select and highlight a shortcode in your editor to edit.';
132
+ $innerContent.html("<h3>"+msg+"</h3><p><code style='padding-left:0;padding-right:0'>"+error+"</code></p>");
133
+ }
134
+ }
135
+ }
136
+
137
+ } )( jQuery );
includes/admin/js/wcpostsliderwidget.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ) {
2
+ "use strict";
3
+
4
+ $.fn.extend({
5
+ // change 'pluginname' to your plugin name (duh)
6
+ wcPostSliderWidget: function(options) {
7
+ // options for the plugin
8
+ var defaults = {
9
+ postTypeSelector: '.wc-shortcodes-widget-post-type-selector',
10
+ taxonomySelector: '.wc-shortcodes-widget-taxonomy-selector',
11
+ autoCompleteSelector: '.wc-shortcodes-widget-autocomplete-select'
12
+ }
13
+
14
+ var options = $.extend(defaults, options);
15
+
16
+ var split = function ( val ) {
17
+ return val.split( /,\s*/ );
18
+ }
19
+ var extractLast = function( term ) {
20
+ return split( term ).pop();
21
+ }
22
+
23
+ return this.each(function() {
24
+ var $this = $(this);
25
+ var $autoComplete = $this.find( options.autoCompleteSelector );
26
+ var $post_type = $this.find( options.postTypeSelector );
27
+ var $taxonomy = $this.find( options.taxonomySelector );
28
+
29
+ if ( $autoComplete.length ) {
30
+ $autoComplete.each( function( index, el ) {
31
+ var $el = $(el);
32
+ var $parent = $el.parent();
33
+ $parent.css({'position':'relative'});
34
+ var type = $el.data('autocompleteType');
35
+ var lookup = $el.data('autocompleteLookup');
36
+ var post_type = 'post';
37
+ var taxonomy = '';
38
+ var options = '';
39
+
40
+ if ( 'multi' == type ) {
41
+ options = {
42
+ minLength: 0,
43
+ appendTo: $parent,
44
+ source: function(request, response) {
45
+ var term = extractLast( request.term );
46
+ if ( $post_type.length ) {
47
+ post_type = $post_type.val();
48
+ }
49
+ if ( $taxonomy.length ) {
50
+ taxonomy = $taxonomy.val();
51
+ }
52
+ $.ajax({
53
+ type: 'POST',
54
+ dataType: 'json',
55
+ url: ajaxurl,
56
+ data: 'action=wc_' + lookup + '_lookup&request=' + term + '&post_type=' + post_type + '&taxonomy=' + taxonomy,
57
+ success: function(data) {
58
+ response( data );
59
+ }
60
+ });
61
+ },
62
+ select: function( event, ui ) {
63
+ var terms = split( this.value );
64
+ // remove the current input
65
+ terms.pop();
66
+ // add the selected item
67
+ terms.push( ui.item.value );
68
+ // add placeholder to get the comma-and-space at the end
69
+ terms.push( "" );
70
+
71
+ $(this).val( terms.join( "," ) );
72
+
73
+ return false;
74
+ },
75
+ close: function( event, ui ) {
76
+ var $t = $(this);
77
+ $t.trigger('change');
78
+ setTimeout(function(){
79
+ $t.blur();
80
+ }, 0);
81
+ }
82
+ }
83
+ }
84
+ else {
85
+ options = {
86
+ minLength: 0,
87
+ appendTo: $parent,
88
+ source: function(request, response) {
89
+ var term = request.term;
90
+ if ( $post_type.length ) {
91
+ post_type = $post_type.val();
92
+ }
93
+ if ( $taxonomy.length ) {
94
+ taxonomy = $taxonomy.val();
95
+ }
96
+ $.ajax({
97
+ type: 'POST',
98
+ dataType: 'json',
99
+ url: ajaxurl,
100
+ data: 'action=wc_' + lookup + '_lookup&request=' + term + '&post_type=' + post_type + '&taxonomy=' + taxonomy,
101
+ success: function(data) {
102
+ response(data);
103
+ }
104
+ });
105
+ },
106
+ close: function ( event, ui ) {
107
+ var $t = $(this);
108
+ $t.trigger('change');
109
+ setTimeout(function(){
110
+ $t.blur();
111
+ }, 0);
112
+ }
113
+ };
114
+ }
115
+
116
+ $el.autocomplete( options ).bind('focus', function(){ $(this).autocomplete("search"); } );
117
+ });
118
+ }
119
+ if ( $taxonomy.length ) {
120
+ $taxonomy.change( function() {
121
+ var $th = $(this);
122
+ var $option = $th.find(":selected");
123
+ if ( $option.length ) {
124
+ var post_type = $option.data('postType');
125
+ if ( typeof post_type == "string" ) {
126
+ $post_type.val(post_type);
127
+ }
128
+ }
129
+ });
130
+ }
131
+ });
132
+ }
133
+ });
134
+ } )( jQuery );
includes/ajax.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * webpm_send_email
5
+ *
6
+ * Ajax function to send email without
7
+ * reloading the page.
8
+ *
9
+ * @access public
10
+ * @return void
11
+ */
12
+ function wc_shortcodes_send_rsvp_email() {
13
+ // get the submitted parameters
14
+ $error = array();
15
+ $emailSent = false;
16
+ $message = array();
17
+
18
+ $email_to = get_option( WC_SHORTCODES_PREFIX . 'rsvp_email');
19
+ $email_title = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_email_title') );
20
+ $email_success_message = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_success_message') );
21
+ $email_success_message = empty( $email_success_message ) ? 'Message Sent' : $email_success_message;
22
+
23
+ $admin_email = get_option('admin_email');
24
+ if ( empty( $email_to ) ) {
25
+ $email_to = $admin_email;
26
+ }
27
+
28
+ $rsvp_name = trim( $_POST['rsvp_name'] );
29
+ if ( $rsvp_name === '') {
30
+ $error[] = 'Please enter your name.';
31
+ $hasError = true;
32
+ } else {
33
+ $message[] = 'Name: ' . esc_html( $rsvp_name );
34
+ }
35
+
36
+ $rsvp_number = trim( $_POST['rsvp_number'] );
37
+ if ( $rsvp_number === '') {
38
+ $error[] = 'Please select a number.';
39
+ $hasError = true;
40
+ } else {
41
+ $message[] = 'Number: ' . esc_html( $rsvp_number );
42
+ }
43
+
44
+ $rsvp_event = trim( $_POST['rsvp_event'] );
45
+ if ( $rsvp_event === '') {
46
+ $error[] = 'Please select event.';
47
+ $hasError = true;
48
+ } else {
49
+ $message[] = 'Event: ' . esc_html( $rsvp_event );
50
+ }
51
+
52
+ $status = trim(implode("<br />", $error));
53
+
54
+ if ( empty( $error ) ) {
55
+ $subject = $email_title;
56
+ $name = $rsvp_name;
57
+ $body = implode( "\n\n", $message );
58
+ $body .= "\n\n\n\nThis message was sent through the contact form via ".get_bloginfo('url');
59
+ $headers = "From: " . $admin_email . "\r\n";
60
+
61
+ wp_mail($email_to, $subject, $body, $headers);
62
+ $emailSent = true;
63
+ $status = $email_success_message;
64
+ }
65
+
66
+ // generate the response
67
+ $response = json_encode( array( 'success' => (int) $emailSent, 'message' => $status ) );
68
+
69
+ // response output
70
+ header( "Content-Type: application/json" );
71
+ echo $response;
72
+
73
+ // IMPORTANT: don't forget to "exit"
74
+ exit;
75
+ }
76
+ // send email when logged out
77
+ add_action( 'wp_ajax_nopriv_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
78
+ // send email when logged in
79
+ add_action( 'wp_ajax_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
80
+
81
+ function wc_shortcodes_post_lookup_callback() {
82
+ global $wpdb; //get access to the WordPress database object variable
83
+
84
+ //get names of all businesses
85
+ $request = '%' . $wpdb->esc_like( stripslashes( $_POST['request'] ) ) . '%'; //escape for use in LIKE statement
86
+ $post_type = stripslashes( $_POST['post_type'] );
87
+ $sql = "
88
+ select
89
+ ID,
90
+ post_title
91
+ from
92
+ $wpdb->posts
93
+ where
94
+ post_title like %s
95
+ and post_type='%s'
96
+ and post_status='publish'
97
+ order by
98
+ post_title ASC
99
+ limit
100
+ 0,30
101
+ ";
102
+
103
+ $sql = $wpdb->prepare($sql, $request, $post_type);
104
+
105
+ $results = $wpdb->get_results($sql);
106
+
107
+ //copy the business titles to a simple array
108
+ $titles = array();
109
+ $i = 0;
110
+ foreach( $results as $r ) {
111
+ $titles[ $i ][ 'label' ] = $r->post_title . " (" . $r->ID . ")";
112
+ $titles[ $i ][ 'value' ] = $r->ID;
113
+ $i++;
114
+ }
115
+
116
+ if ( empty( $titles ) ) {
117
+ $titles[0]['label'] = "No results found in post type \"$post_type\".";
118
+ $titles[0]['value'] = "0";
119
+ }
120
+
121
+ echo json_encode($titles); //encode into JSON format and output
122
+
123
+ die(); //stop "0" from being output
124
+ }
125
+ add_action( 'wp_ajax_wc_post_lookup', 'wc_shortcodes_post_lookup_callback' );
126
+
127
+ function wc_shortcodes_terms_lookup_callback() {
128
+ global $wpdb; //get access to the WordPress database object variable
129
+
130
+ //get names of all businesses
131
+ $request = '%' . $wpdb->esc_like( stripslashes( $_POST['request'] ) ) . '%'; //escape for use in LIKE statement
132
+ $post_type = stripslashes( $_POST['post_type'] );
133
+ $taxonomy = stripslashes( $_POST['taxonomy'] );
134
+
135
+ if ( empty( $taxonomy ) ) {
136
+ $titles = array();
137
+ $titles[0]['label'] = "Please select a taxonomy.";
138
+ $titles[0]['value'] = "0";
139
+
140
+ echo json_encode($titles); //encode into JSON format and output
141
+
142
+ die(); //stop "0" from being output
143
+ }
144
+
145
+ $sql = "
146
+ SELECT
147
+ t.slug,
148
+ t.slug
149
+ FROM $wpdb->terms AS t
150
+ INNER JOIN $wpdb->term_taxonomy AS tt ON (tt.term_id = t.term_id)
151
+ INNER JOIN $wpdb->term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
152
+ WHERE t.slug like %s
153
+ AND tt.taxonomy IN ('%s')
154
+ GROUP BY
155
+ t.slug
156
+ ORDER BY
157
+ t.name ASC
158
+ limit
159
+ 0,30
160
+ ";
161
+
162
+ $sql = $wpdb->prepare($sql, $request, $taxonomy);
163
+
164
+ $results = $wpdb->get_results($sql);
165
+
166
+ //copy the business titles to a simple array
167
+ $titles = array();
168
+ $i = 0;
169
+ foreach( $results as $r ) {
170
+ $titles[ $i ]['label'] = $r->slug;
171
+ $titles[ $i ]['value'] = $r->slug;
172
+ $i++;
173
+ }
174
+
175
+ if ( empty( $titles ) ) {
176
+ $titles[0]['label'] = "No results found in selected taxonomy \"$taxonomy\".";
177
+ $titles[0]['value'] = "0";
178
+ }
179
+
180
+ echo json_encode($titles); //encode into JSON format and output
181
+
182
+ die(); //stop "0" from being output
183
+ }
184
+ add_action( 'wp_ajax_wc_terms_lookup', 'wc_shortcodes_terms_lookup_callback' );
185
+
186
+ function wc_shortcodes_mce_popup() {
187
+
188
+ $tag = $_POST['tag'];
189
+ $shortcode = stripslashes( $_POST['shortcode'] );
190
+ $attr = wc_shortcodes_parse_shortcode( $tag, $shortcode );
191
+
192
+ switch ( $tag ) {
193
+ case 'wc_post_slider' :
194
+ $widget = new WC_Shortcodes_Post_Slider_Widget();
195
+ $widget->form( $attr );
196
+ break;
197
+ }
198
+
199
+ die();
200
+ }
201
+ add_action( 'wp_ajax_wc_mce_popup', 'wc_shortcodes_mce_popup' );
includes/css/style.css CHANGED
@@ -1838,6 +1838,7 @@ pre.pre-wrap {
1838
  background-position: center;
1839
  background-repeat: no-repeat;
1840
  background-color: #cccccc;
 
1841
  }
1842
  .wc-shortcodes-post-slide-border {
1843
  display: table;
@@ -1903,14 +1904,14 @@ pre.pre-wrap {
1903
  .bx-wrapper .bx-controls-direction a {
1904
  position: absolute;
1905
  top: 50%;
1906
- margin-top: -17px;
1907
  outline: 0;
1908
- width: 34px;
1909
- height: 34px;
1910
- line-height: 30px;
1911
  z-index: 9999;
1912
- border: 2px solid #ffffff;
1913
- border-radius: 9999px;
1914
  text-align:center;
1915
  opacity: 0;
1916
  color: #ffffff;
@@ -1941,8 +1942,10 @@ pre.pre-wrap {
1941
  .bx-wrapper:hover .bx-controls-direction a {
1942
  opacity: 1;
1943
  }
1944
- .wc-shortcodes-read-more {
 
1945
  display: block;
 
1946
  }
1947
  .wc-shortcodes-post-slide-button:hover {
1948
  text-decoration: none;
1838
  background-position: center;
1839
  background-repeat: no-repeat;
1840
  background-color: #cccccc;
1841
+ margin: 0 !important;
1842
  }
1843
  .wc-shortcodes-post-slide-border {
1844
  display: table;
1904
  .bx-wrapper .bx-controls-direction a {
1905
  position: absolute;
1906
  top: 50%;
1907
+ margin-top: -30px;
1908
  outline: 0;
1909
+ line-height: 1;
1910
+ padding: 10px;
1911
+ font-size: 50px;
1912
  z-index: 9999;
1913
+ border: 0px solid #ffffff;
1914
+ border-radius: 0;
1915
  text-align:center;
1916
  opacity: 0;
1917
  color: #ffffff;
1942
  .bx-wrapper:hover .bx-controls-direction a {
1943
  opacity: 1;
1944
  }
1945
+ /* END DIRECTION */
1946
+ .wc-shortcodes-post-slider .wc-shortcodes-read-more {
1947
  display: block;
1948
+ margin-top: 20px;
1949
  }
1950
  .wc-shortcodes-post-slide-button:hover {
1951
  text-decoration: none;
includes/functions.php CHANGED
@@ -73,84 +73,6 @@ function wc_shortcodes_default_social_icons() {
73
  return $default;
74
  }
75
 
76
- /**
77
- * webpm_send_email
78
- *
79
- * Ajax function to send email without
80
- * reloading the page.
81
- *
82
- * @access public
83
- * @return void
84
- */
85
- function wc_shortcodes_send_rsvp_email() {
86
- // get the submitted parameters
87
- $error = array();
88
- $emailSent = false;
89
- $message = array();
90
-
91
- $email_to = get_option( WC_SHORTCODES_PREFIX . 'rsvp_email');
92
- $email_title = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_email_title') );
93
- $email_success_message = trim( get_option( WC_SHORTCODES_PREFIX . 'rsvp_success_message') );
94
- $email_success_message = empty( $email_success_message ) ? 'Message Sent' : $email_success_message;
95
-
96
- $admin_email = get_option('admin_email');
97
- if ( empty( $email_to ) ) {
98
- $email_to = $admin_email;
99
- }
100
-
101
- $rsvp_name = trim( $_POST['rsvp_name'] );
102
- if ( $rsvp_name === '') {
103
- $error[] = 'Please enter your name.';
104
- $hasError = true;
105
- } else {
106
- $message[] = 'Name: ' . esc_html( $rsvp_name );
107
- }
108
-
109
- $rsvp_number = trim( $_POST['rsvp_number'] );
110
- if ( $rsvp_number === '') {
111
- $error[] = 'Please select a number.';
112
- $hasError = true;
113
- } else {
114
- $message[] = 'Number: ' . esc_html( $rsvp_number );
115
- }
116
-
117
- $rsvp_event = trim( $_POST['rsvp_event'] );
118
- if ( $rsvp_event === '') {
119
- $error[] = 'Please select event.';
120
- $hasError = true;
121
- } else {
122
- $message[] = 'Event: ' . esc_html( $rsvp_event );
123
- }
124
-
125
- $status = trim(implode("<br />", $error));
126
-
127
- if ( empty( $error ) ) {
128
- $subject = $email_title;
129
- $name = $rsvp_name;
130
- $body = implode( "\n\n", $message );
131
- $body .= "\n\n\n\nThis message was sent through the contact form via ".get_bloginfo('url');
132
- $headers = "From: " . $admin_email . "\r\n";
133
-
134
- wp_mail($email_to, $subject, $body, $headers);
135
- $emailSent = true;
136
- $status = $email_success_message;
137
- }
138
-
139
- // generate the response
140
- $response = json_encode( array( 'success' => (int) $emailSent, 'message' => $status ) );
141
-
142
- // response output
143
- header( "Content-Type: application/json" );
144
- echo $response;
145
-
146
- // IMPORTANT: don't forget to "exit"
147
- exit;
148
- }
149
- // send email when logged out
150
- add_action( 'wp_ajax_nopriv_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
151
- // send email when logged in
152
- add_action( 'wp_ajax_wc-send-rsvp-email', 'wc_shortcodes_send_rsvp_email' );
153
-
154
  if ( ! function_exists( 'wc_shortcodes_display_term_classes' ) ) {
155
  function wc_shortcodes_display_term_classes( $taxonomy ) {
156
  global $post;
@@ -458,3 +380,39 @@ function wc_shortcodes_get_posted_category() {
458
 
459
  return $html;
460
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  return $default;
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  if ( ! function_exists( 'wc_shortcodes_display_term_classes' ) ) {
77
  function wc_shortcodes_display_term_classes( $taxonomy ) {
78
  global $post;
380
 
381
  return $html;
382
  }
383
+
384
+ function wc_shortcodes_parse_shortcode( $check_tag, $content ) {
385
+ global $shortcode_tags;
386
+
387
+ if ( false === strpos( $content, '[' ) ) {
388
+ return false;
389
+ }
390
+
391
+ if (empty($shortcode_tags) || !is_array($shortcode_tags))
392
+ return false;
393
+
394
+ // Find all registered tag names in $content.
395
+ preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
396
+ $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
397
+
398
+ if ( empty( $tagnames ) ) {
399
+ return false;
400
+ }
401
+
402
+ $pattern = get_shortcode_regex( $tagnames );
403
+ preg_match( "/$pattern/", $content, $m );
404
+
405
+ // allow [[foo]] syntax for escaping a tag
406
+ if ( $m[1] == '[' && $m[6] == ']' ) {
407
+ return substr($m[0], 1, -1);
408
+ }
409
+
410
+ $tag = $m[2];
411
+
412
+ if ( $tag != $check_tag )
413
+ return false;
414
+
415
+ $attr = shortcode_parse_atts( $m[3] );
416
+
417
+ return $attr;
418
+ }
includes/js/post-slider.js CHANGED
@@ -2,14 +2,24 @@
2
  "use strict";
3
 
4
  $(document).ready(function(){
5
- $('.wc-shortcodes-post-slider').bxSlider({
6
- 'pager' : false,
7
- 'mode' : 'fade',
8
- 'nextText' : "<i class='fa fa-angle-right'></i>",
9
- 'prevText' : "<i class='fa fa-angle-left'></i>",
10
- 'onSliderLoad' : function() {
11
- $(this).parent().parent().parent('.wc-shortcodes-post-slider-wrapper').css('height', 'auto');
12
- }
 
 
 
 
 
 
 
 
 
 
13
  });
14
  });
15
  } )( jQuery );
2
  "use strict";
3
 
4
  $(document).ready(function(){
5
+ $('.wc-shortcodes-post-slider').each( function( index, el ) {
6
+ var $this = $(this);
7
+ var mode = $this.data('mode');
8
+ var pause = $this.data('pause');
9
+ var auto = $this.data('auto');
10
+ $this.bxSlider({
11
+ 'pager' : false,
12
+ 'mode' : mode,
13
+ 'auto' : auto,
14
+ 'autoHover' : true,
15
+ 'autoStart' : auto,
16
+ 'pause' : pause,
17
+ 'nextText' : "<i class='fa fa-angle-right'></i>",
18
+ 'prevText' : "<i class='fa fa-angle-left'></i>",
19
+ 'onSliderLoad' : function() {
20
+ $(this).parent().parent().parent('.wc-shortcodes-post-slider-wrapper').css('height', 'auto');
21
+ }
22
+ });
23
  });
24
  });
25
  } )( jQuery );
includes/mce/js/shortcodes-tinymce-4.js CHANGED
@@ -5,6 +5,7 @@
5
  var wcDummyContent = 'Sample Content';
6
  var wcParagraphContent = '<p>Sample Content</p>';
7
  var wcDummyParagraphContent = '<p>Sample Content</p>';
 
8
 
9
  editor.addButton('wpc_shortcodes_button', function() {
10
 
@@ -13,9 +14,9 @@
13
  text: "[ ]",
14
  image: url + "/images/shortcodes.png",
15
  type: 'menubutton',
16
- icons: false,
17
  onclick: function() {
18
- var mceSelected = editor.selection.getContent({format: 'text'});
19
  if ( mceSelected ) {
20
  wcDummyContent = mceSelected;
21
  wcParagraphContent = '<p>' + mceSelected + '</p>';
@@ -200,13 +201,15 @@
200
  {
201
  text: "Post Slider 1",
202
  onclick: function(){
203
- editor.insertContent('[wc_post_slider author="" author_name="" p="" post__in="" order="DESC" orderby="name" post_status="publish" post_type="post" posts_per_page="10" taxonomy="" field="slug" terms="" meta_category="yes" title="yes" content="yes" readmore="Continue Reading" button_class="" size="full" heading_type="h2" heading_size="30" mobile_heading_size="24" excerpt_length="30" desktop_height="600" laptop_height="500" mobile_height="350" template="slider1"][/wc_post_slider]');
 
204
  }
205
  },
206
  {
207
  text: "Post Slider 2",
208
  onclick: function(){
209
- editor.insertContent('[wc_post_slider author="" author_name="" p="" post__in="" order="DESC" orderby="name" post_status="publish" post_type="post" posts_per_page="10" taxonomy="" field="slug" terms="" meta_category="no" title="yes" content="yes" readmore="Continue Reading" button_class="button secondary-button" size="full" heading_type="h2" heading_size="30" mobile_heading_size="24" excerpt_length="30" desktop_height="600" laptop_height="500" mobile_height="350" template="slider2"][/wc_post_slider]');
 
210
  }
211
  }
212
  ]
@@ -404,6 +407,12 @@
404
  }
405
  ]
406
  },
 
 
 
 
 
 
407
  ]
408
  }
409
  });
5
  var wcDummyContent = 'Sample Content';
6
  var wcParagraphContent = '<p>Sample Content</p>';
7
  var wcDummyParagraphContent = '<p>Sample Content</p>';
8
+ var mceSelected = '';
9
 
10
  editor.addButton('wpc_shortcodes_button', function() {
11
 
14
  text: "[ ]",
15
  image: url + "/images/shortcodes.png",
16
  type: 'menubutton',
17
+ icon: false,
18
  onclick: function() {
19
+ mceSelected = editor.selection.getContent({format: 'text'});
20
  if ( mceSelected ) {
21
  wcDummyContent = mceSelected;
22
  wcParagraphContent = '<p>' + mceSelected + '</p>';
201
  {
202
  text: "Post Slider 1",
203
  onclick: function(){
204
+ var shortcode = '[wc_post_slider pids="" order="DESC" orderby="name" post_type="post" taxonomy="" terms="" posts_per_page="10" ignore_sticky_posts="0" show_meta_category="1" show_title="1" show_content="1" readmore="Continue Reading" button_class="" size="full" heading_type="h2" template="slider1" heading_size="24" mobile_heading_size="24" excerpt_length="30" desktop_height="600" laptop_height="500" mobile_height="350" slider_mode="fade" slider_pause="4000" slider_auto="0"][/wc_post_slider]';
205
+ wcShortcodes( shortcode, editor );
206
  }
207
  },
208
  {
209
  text: "Post Slider 2",
210
  onclick: function(){
211
+ var shortcode = '[wc_post_slider pids="" order="DESC" orderby="name" post_type="post" taxonomy="" terms="" posts_per_page="10" ignore_sticky_posts="0" show_meta_category="0" show_title="1" show_content="1" readmore="Continue Reading" button_class="button secondary-button" size="full" heading_type="h2" template="slider2" heading_size="24" mobile_heading_size="24" excerpt_length="30" desktop_height="600" laptop_height="500" mobile_height="350" slider_mode="fade" slider_pause="4000" slider_auto="0"][/wc_post_slider]';
212
+ wcShortcodes( shortcode, editor );
213
  }
214
  }
215
  ]
407
  }
408
  ]
409
  },
410
+ {
411
+ text: "[edit_selection]",
412
+ onclick: function(){
413
+ wcShortcodes( mceSelected, editor );
414
+ }
415
+ }
416
  ]
417
  }
418
  });
includes/options.php CHANGED
@@ -258,16 +258,25 @@ function wc_shortcodes_options( $options ) {
258
  'title' => 'Shortcode CSS',
259
  'default' => '1',
260
  'description' => '',
261
- 'label' => 'Use shortcode CSS provided by plugin',
262
  'type' => 'checkbox',
263
  'theme_reset' => true,
264
  ),
265
  array(
266
  'option_name' => 'enable_font_awesome',
267
- 'title' => 'Enable FontAwesome',
268
  'default' => '1',
269
  'description' => '',
270
- 'label' => 'Use font icons provided by FontAwesome',
 
 
 
 
 
 
 
 
 
271
  'type' => 'checkbox',
272
  'theme_reset' => true,
273
  ),
258
  'title' => 'Shortcode CSS',
259
  'default' => '1',
260
  'description' => '',
261
+ 'label' => 'Use shortcode CSS provided by plugin.',
262
  'type' => 'checkbox',
263
  'theme_reset' => true,
264
  ),
265
  array(
266
  'option_name' => 'enable_font_awesome',
267
+ 'title' => 'FontAwesome',
268
  'default' => '1',
269
  'description' => '',
270
+ 'label' => 'Use FontAwesome icons provided by plugin.',
271
+ 'type' => 'checkbox',
272
+ 'theme_reset' => true,
273
+ ),
274
+ array(
275
+ 'option_name' => 'enable_slide_post_type',
276
+ 'title' => 'Slide Post Type',
277
+ 'default' => '1',
278
+ 'description' => '',
279
+ 'label' => 'Create custom slides to use with our <code>[wc_post_slider]</code> shortcode.',
280
  'type' => 'checkbox',
281
  'theme_reset' => true,
282
  ),
includes/post-types.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File for registering custom post types.
4
+ *
5
+ * @package WC Custom Post Types
6
+ * @since 1.1
7
+ * @author Chris Baldelomar <chris@webplantmedia.com>
8
+ * @copyright Copyright (c) 2013, Chris Baldelomar
9
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Registers post types needed by the plugin.
14
+ *
15
+ * @since 0.1.0
16
+ * @access public
17
+ * @return void
18
+ */
19
+ function wc_shortcodes_register_post_types() {
20
+
21
+ /* Set up the arguments for the slider item post type. */
22
+ $args = array(
23
+ 'description' => '',
24
+ 'public' => false,
25
+ 'publicly_queryable' => false,
26
+ 'show_in_nav_menus' => false,
27
+ 'show_in_admin_bar' => true,
28
+ 'exclude_from_search' => true,
29
+ 'show_ui' => true,
30
+ 'show_in_menu' => true,
31
+ 'menu_position' => 11,
32
+ 'menu_icon' => 'dashicons-images-alt2',
33
+ 'can_export' => true,
34
+ 'delete_with_user' => false,
35
+ 'hierarchical' => false,
36
+ 'has_archive' => false,
37
+ 'query_var' => false,
38
+ 'register_meta_box_cb' => 'wc_shortcodes_slide_metabox',
39
+
40
+ /* The rewrite handles the URL structure. */
41
+ 'rewrite' => false,
42
+
43
+ /* What features the post type supports. */
44
+ 'supports' => array(
45
+ 'title',
46
+ 'editor',
47
+ 'thumbnail',
48
+ 'page-attributes',
49
+ ),
50
+
51
+ /* Labels used when displaying the posts. */
52
+ 'labels' => array(
53
+ 'name' => __( 'Slider Items', 'wc-shortcodes' ),
54
+ 'singular_name' => __( 'Slider Item', 'wc-shortcodes' ),
55
+ 'menu_name' => __( 'Slider', 'wc-shortcodes' ),
56
+ 'name_admin_bar' => __( 'Slider Item', 'wc-shortcodes' ),
57
+ 'add_new' => __( 'Add New', 'wc-shortcodes' ),
58
+ 'add_new_item' => __( 'Add New Slider Item', 'wc-shortcodes' ),
59
+ 'edit_item' => __( 'Edit Slider Item', 'wc-shortcodes' ),
60
+ 'new_item' => __( 'New Slider Item', 'wc-shortcodes' ),
61
+ 'view_item' => __( 'View Slider Item', 'wc-shortcodes' ),
62
+ 'search_items' => __( 'Search Slider', 'wc-shortcodes' ),
63
+ 'not_found' => __( 'No slider items found', 'wc-shortcodes' ),
64
+ 'not_found_in_trash' => __( 'No slider items found in trash', 'wc-shortcodes' ),
65
+ 'all_items' => __( 'Slider Items', 'wc-shortcodes' ),
66
+
67
+ // Custom labels b/c WordPress doesn't have anything to handle this.
68
+ 'archive_title' => __( 'Slider', 'wc-shortcodes' ),
69
+ )
70
+ );
71
+
72
+ /* Register the slider item post type. */
73
+ register_post_type( 'wcs_slide', $args );
74
+ }
75
+ /* Register custom post types on the 'init' hook. */
76
+ add_action( 'init', 'wc_shortcodes_register_post_types' );
77
+
78
+ /**
79
+ * Register taxonomies for the plugin.
80
+ *
81
+ * @since 0.1.0
82
+ * @access public
83
+ * @return void.
84
+ */
85
+ function wc_shortcodes_register_taxonomies() {
86
+
87
+ /* Set up the arguments for the slider taxonomy. */
88
+ $args = array(
89
+ 'public' => false,
90
+ 'show_ui' => true,
91
+ 'show_in_nav_menus' => false,
92
+ 'show_tagcloud' => false,
93
+ 'show_admin_column' => true,
94
+ 'hierarchical' => true,
95
+ 'query_var' => false,
96
+
97
+ /* The rewrite handles the URL structure. */
98
+ 'rewrite' => false,
99
+
100
+ /* Labels used when displaying taxonomy and terms. */
101
+ 'labels' => array(
102
+ 'name' => __( 'Slider Categories', 'wc-shortcodes' ),
103
+ 'singular_name' => __( 'Slider Category', 'wc-shortcodes' ),
104
+ 'menu_name' => __( 'Categories', 'wc-shortcodes' ),
105
+ 'name_admin_bar' => __( 'Slider Category', 'wc-shortcodes' ),
106
+ 'search_items' => __( 'Search Slider Categories', 'wc-shortcodes' ),
107
+ 'popular_items' => __( 'Popular Slider Categories', 'wc-shortcodes' ),
108
+ 'all_items' => __( 'All Slider Categories', 'wc-shortcodes' ),
109
+ 'edit_item' => __( 'Edit Slider Category', 'wc-shortcodes' ),
110
+ 'view_item' => __( 'View Slider Category', 'wc-shortcodes' ),
111
+ 'update_item' => __( 'Update Slider Category', 'wc-shortcodes' ),
112
+ 'add_new_item' => __( 'Add New Slider Category', 'wc-shortcodes' ),
113
+ 'new_item_name' => __( 'New Slider Category Name', 'wc-shortcodes' ),
114
+ 'separate_items_with_commas' => __( 'Separate slider categories with commas', 'wc-shortcodes' ),
115
+ 'add_or_remove_items' => __( 'Add or remove slider categories', 'wc-shortcodes' ),
116
+ 'choose_from_most_used' => __( 'Choose from the most used slider categories', 'wc-shortcodes' ),
117
+ )
118
+ );
119
+
120
+ /* Register the 'slider' taxonomy. */
121
+ register_taxonomy( 'wcs_slide_cat', array( 'wcs_slide' ), $args );
122
+
123
+ /* Set up the arguments for the slider taxonomy. */
124
+ $args = array(
125
+ 'public' => false,
126
+ 'show_ui' => true,
127
+ 'show_in_nav_menus' => false,
128
+ 'show_tagcloud' => false,
129
+ 'show_admin_column' => true,
130
+ 'hierarchical' => false,
131
+ 'query_var' => 'slider_tag',
132
+
133
+ /* The rewrite handles the URL structure. */
134
+ 'rewrite' => false,
135
+
136
+ /* Labels used when displaying taxonomy and terms. */
137
+ 'labels' => array(
138
+ 'name' => __( 'Slider Tags', 'wc-shortcodes' ),
139
+ 'singular_name' => __( 'Slider Tag', 'wc-shortcodes' ),
140
+ 'menu_name' => __( 'Tags', 'wc-shortcodes' ),
141
+ 'name_admin_bar' => __( 'Slider Tag', 'wc-shortcodes' ),
142
+ 'search_items' => __( 'Search Slider Tags', 'wc-shortcodes' ),
143
+ 'popular_items' => __( 'Popular Slider Tags', 'wc-shortcodes' ),
144
+ 'all_items' => __( 'All Slider Tags', 'wc-shortcodes' ),
145
+ 'edit_item' => __( 'Edit Slider Tag', 'wc-shortcodes' ),
146
+ 'view_item' => __( 'View Slider Tag', 'wc-shortcodes' ),
147
+ 'update_item' => __( 'Update Slider Tag', 'wc-shortcodes' ),
148
+ 'add_new_item' => __( 'Add New Slider Tag', 'wc-shortcodes' ),
149
+ 'new_item_name' => __( 'New Slider Tag Name', 'wc-shortcodes' ),
150
+ 'separate_items_with_commas' => __( 'Separate slider tags with commas', 'wc-shortcodes' ),
151
+ 'add_or_remove_items' => __( 'Add or remove slider tags', 'wc-shortcodes' ),
152
+ 'choose_from_most_used' => __( 'Choose from the most used slider tags', 'wc-shortcodes' ),
153
+ )
154
+ );
155
+
156
+ /* Register the 'slider' taxonomy. */
157
+ register_taxonomy( 'wcs_slide_tag', array( 'wcs_slide' ), $args );
158
+ }
159
+ /* Register taxonomies on the 'init' hook. */
160
+ add_action( 'init', 'wc_shortcodes_register_taxonomies' );
161
+
162
+ function wc_shortcodes_save_meta($post_id, $post) {
163
+
164
+ if ( ! isset( $_POST['slidedetails_noncename'] ) ) {
165
+ return;
166
+ }
167
+
168
+ // verify this came from the our screen and with proper authorization,
169
+ // because save_post can be triggered at other times
170
+ if ( ! wp_verify_nonce( $_POST['slidedetails_noncename'], plugin_basename(__FILE__) )) {
171
+ return $post->ID;
172
+ }
173
+
174
+ // Is the user allowed to edit the post or page?
175
+ if ( !current_user_can( 'edit_post', $post->ID ))
176
+ return $post->ID;
177
+
178
+ // OK, we're authenticated: we need to find and save the data
179
+ // We'll put it into an array to make it easier to loop though.
180
+
181
+ $meta['_wc_shortcodes_slide_url'] = esc_url_raw( $_POST['_wc_shortcodes_slide_url'] );
182
+
183
+ // Add values of $events_meta as custom fields
184
+
185
+ foreach ( $meta as $key => $value ) { // Cycle through the $events_meta array!
186
+ if( $post->post_type == 'revision' ) {
187
+ // Don't store custom data twice
188
+ return;
189
+ }
190
+
191
+ // $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
192
+
193
+ if ( get_post_meta( $post->ID, $key, false ) ) {
194
+ // If the custom field already has a value
195
+ update_post_meta( $post->ID, $key, $value );
196
+ } else {
197
+ // If the custom field doesn't have a value
198
+ add_post_meta( $post->ID, $key, $value );
199
+ }
200
+ if( ! $value ) {
201
+ delete_post_meta( $post->ID, $key ); // Delete if blank
202
+ }
203
+ }
204
+
205
+ }
206
+
207
+ add_action('save_post', 'wc_shortcodes_save_meta', 1, 2); // save the custom fields
208
+
209
+ function wc_shortcodes_slide_details() {
210
+ global $post;
211
+
212
+ // Noncename needed to verify where the data originated
213
+ echo '<input type="hidden" name="slidedetails_noncename" id="slidedetails_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
214
+
215
+ // Get the location data if its already been entered
216
+ $url = get_post_meta($post->ID, '_wc_shortcodes_slide_url', true);
217
+
218
+ echo '<p><strong>Enter URL:</strong></p>';
219
+ echo '<input type="text" name="_wc_shortcodes_slide_url" value="' . $url . '" class="widefat" />';
220
+ }
221
+
222
+ function wc_shortcodes_slide_metabox() {
223
+ add_meta_box('wc-shortcodes-slide-metabox', 'Slide Details', 'wc_shortcodes_slide_details', 'wcs_slide', 'normal', 'high');
224
+ }
225
+ add_action( 'add_meta_boxes', 'wc_shortcodes_slide_metabox' );
226
+
227
+ ?>
includes/scripts.php CHANGED
@@ -66,3 +66,15 @@ if( ! function_exists('wc_shortcodes_scripts_override') ) :
66
  }
67
  add_action('wp_enqueue_scripts', 'wc_shortcodes_scripts_override', 9999 );
68
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
  add_action('wp_enqueue_scripts', 'wc_shortcodes_scripts_override', 9999 );
68
  endif;
69
+
70
+ function wc_shortcodes_admin_enqueue_scripts( $hook ) {
71
+ $ver = WC_SHORTCODES_VERSION;
72
+
73
+ if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'widgets.php' ) {
74
+ wp_enqueue_style( 'wc-shortcodes-admin-style', plugin_dir_url( __FILE__ ) . 'admin/css/wc-shortcodes.css', array( ), $ver );
75
+ wp_enqueue_style( 'wc-shortcodes-post-slider-widget-style', plugin_dir_url( __FILE__ ) . 'admin/css/wcpostsliderwidget.css', array( ), $ver );
76
+ wp_enqueue_script( 'wc-shortcodes-post-slider-widget', plugin_dir_url( __FILE__ ) . 'admin/js/wcpostsliderwidget.js', array ( 'jquery', 'jquery-ui-autocomplete', 'jquery-ui-accordion' ), $ver, true );
77
+ wp_enqueue_script( 'wc-shortcodes', plugin_dir_url( __FILE__ ) . 'admin/js/wc-shortcodes.js', array ( 'jquery' ), $ver, true );
78
+ }
79
+ }
80
+ add_action( 'admin_enqueue_scripts', 'wc_shortcodes_admin_enqueue_scripts' );
includes/shortcode-functions.php CHANGED
@@ -1334,15 +1334,6 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1334
  add_shortcode( 'wc_posts', 'wc_shortcodes_posts' );
1335
 
1336
  if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1337
- /**
1338
- * Display posts in various formats
1339
- *
1340
- * @since 3.8
1341
- * @access public
1342
- *
1343
- * @param mixed $atts
1344
- * @return void
1345
- */
1346
  function wc_shortcodes_post_slider( $atts ) {
1347
  global $data;
1348
  global $post;
@@ -1354,8 +1345,9 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1354
  $atts = shortcode_atts( array(
1355
  'author' => '', //use author id
1356
  'author_name' => '', //use 'user_nicename' (NOT name).
1357
- 'p' => false, //use post id.
1358
- 'post__in' => false, //use post ids
 
1359
  'order' => 'DESC', // DESC, ASC
1360
  'orderby' => 'date',
1361
  'post_status' => 'publish',
@@ -1368,90 +1360,138 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1368
  'field' => 'slug', // slug or id
1369
  'terms' => '', // taxonomy terms.
1370
 
1371
- 'meta_category' => true, // show heading?
1372
- 'title' => true, // show heading?
1373
- 'content' => true, // show main content?
1374
  'readmore' => 'Continue Reading', // show main content?
1375
  'button_class' => 'button', // show main content?
1376
 
1377
  'size' => 'full', // default thumbnail size
1378
 
1379
  'heading_type' => 'h2', // heading tag for title
1380
- 'heading_size' => '30',
1381
- 'mobile_heading_size' => '24',
1382
  'layout' => 'bxslider', // blog layout
1383
  'template' => 'slider1',
1384
- 'excerpt_length' => '55',
1385
- 'desktop_height' => '650',
1386
- 'laptop_height' => '500',
1387
- 'mobile_height' => '350',
 
 
 
 
1388
  ), $atts );
1389
 
1390
- // fix bug with title argument being added to WP_Query() in 4.4
1391
- $keys = array(
1392
- 'meta_category',
1393
- 'title',
1394
- 'content',
1395
- 'readmore',
1396
- 'button_class',
1397
-
1398
- 'size',
 
 
 
 
1399
 
1400
- 'heading_type',
1401
- 'heading_size',
1402
- 'mobile_heading_size',
1403
- 'layout',
1404
- 'template',
1405
- 'excerpt_length',
1406
- 'desktop_height',
1407
- 'laptop_height',
1408
- 'mobile_height',
1409
- );
 
 
 
 
 
 
 
 
1410
 
1411
- $display = array();
1412
- foreach ( $keys as $key ) {
1413
- $display[ $key ] = $atts[ $key ];
1414
- unset( $atts[ $key ] );
 
 
 
 
 
 
 
 
 
1415
  }
1416
 
1417
- // changed default layout name. Let's catch old inputs
 
1418
  $valid_layouts = array( 'bxslider' );
1419
- if ( ! in_array( $display['layout'], $valid_layouts ) ) {
1420
- $display['layout'] = 'bxslider';
1421
  }
1422
 
1423
  $valid_templates = array( 'slider1', 'slider2' );
1424
- if ( ! in_array( $display['template'], $valid_templates ) ) {
1425
- $display['template'] = 'slider1';
1426
  }
1427
 
1428
- // clean input values
1429
- $atts['terms'] = wc_shortcodes_comma_delim_to_array( $atts['terms'] );
1430
- $wpc_term = null;
1431
- if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
1432
- $wpc_term = $_GET['wpc_term'];
1433
  }
1434
- $atts['post__in'] = wc_shortcodes_comma_delim_to_array( $atts['post__in'] );
1435
- $display['excerpt_length'] = (int) $display['excerpt_length'];
1436
- $atts['order'] = strtoupper( $atts['order'] );
1437
- $display['heading_type'] = strtolower( $display['heading_type'] );
1438
 
1439
- if (isset($atts['posts_per_page']) && $atts['posts_per_page']) {
1440
- $atts['posts_per_page'] = (int) $atts['posts_per_page'];
 
 
1441
  }
1442
- else {
1443
- $atts['posts_per_page'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1444
  }
1445
 
1446
- $display['desktop_height'] = (int) $display['desktop_height'];
1447
- $display['laptop_height'] = (int) $display['laptop_height'];
1448
- $display['mobile_height'] = (int) $display['mobile_height'];
1449
- $display['heading_size'] = (int) $display['heading_size'];
1450
- $display['mobile_heading_size'] = (int) $display['mobile_heading_size'];
 
 
 
 
1451
 
1452
- $display['button_class'] = trim( $display['button_class'] );
1453
- $display['button_class'] = empty( $display['button_class'] ) ? 'wc-shortcodes-post-slide-button' : $display['button_class'];
1454
 
 
 
 
 
 
1455
 
1456
  // add tax query if user specified
1457
  if ( ! empty( $wpc_term ) ) {
@@ -1473,25 +1513,18 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1473
  );
1474
  }
1475
 
1476
- // setting attributes right for the php script
1477
- $valid_headings = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' );
1478
- $display['heading_type'] = in_array( $display['heading_type'], $valid_headings ) ? $display['heading_type'] : 'h2';
1479
-
1480
- ($display['meta_category'] == "yes") ? ($display['meta_category'] = true) : ($display['meta_category'] = false);
1481
- ($display['title'] == "yes") ? ($display['title'] = true) : ($display['title'] = false);
1482
- ($display['content'] == "yes") ? ($display['content'] = true) : ($display['content'] = false);
1483
- ($atts['order'] == "ASC") ? ($atts['order'] = "ASC") : ($atts['order'] = "DESC");
1484
 
1485
- $is_grid = 'grid' == $display['layout'] ? true : false;
1486
 
 
1487
  if ( 'bxslider' == $display['layout'] ) {
1488
  wp_enqueue_script('wc-shortcodes-bxslider');
1489
  wp_enqueue_script('wc-shortcodes-post-slider');
1490
  }
1491
 
1492
- $wc_shortcodes_posts_query = new WP_Query($atts);
1493
- $wc_shortcodes_posts_query->excerpt_length = $display['excerpt_length'];
1494
-
1495
  $html = '';
1496
 
1497
  $html .= '<style>';
@@ -1509,6 +1542,7 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1509
  $html .= '@media (max-width: 767px) {';
1510
  $html .= '#wc-shortcodes-post-slider-'.$instance.' .wc-shortcodes-post-slide {';
1511
  $html .= 'height: ' . $display['mobile_height'] . 'px;';
 
1512
  $html .= '}';
1513
  $html .= '#wc-shortcodes-post-slider-'.$instance.' .wc-shortcodes-entry-title {';
1514
  $html .= 'font-size: ' . $display['mobile_heading_size'] . 'px;';
@@ -1523,24 +1557,25 @@ if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
1523
  $class[] = 'wc-shortcodes-posts-template-' . $display['template'];
1524
 
1525
  $html .= '<div id="" class="wc-shortcodes-post-slider-wrapper">';
1526
- $html .= '<div id="wc-shortcodes-post-slider-'.$instance.'" class="' . implode( ' ', $class ) . '">';
1527
 
1528
- while( $wc_shortcodes_posts_query->have_posts() ) :
1529
- $wc_shortcodes_posts_query->the_post();
1530
-
1531
- if ( $display['content'] && empty( $post->post_excerpt ) && empty( $post->post_content ) )
1532
- $display['content'] = false;
1533
-
1534
- ob_start();
1535
- include('templates/'.$display['template'].'/index.php');
1536
- $html .= ob_get_clean();
1537
 
1538
- endwhile;
 
 
 
1539
 
1540
- $html .= '</div>';
1541
  $html .= '</div>';
1542
 
 
1543
  wp_reset_query();
 
1544
  return $html;
1545
  }
1546
  }
1334
  add_shortcode( 'wc_posts', 'wc_shortcodes_posts' );
1335
 
1336
  if( ! function_exists( 'wc_shortcodes_post_slider' ) ) {
 
 
 
 
 
 
 
 
 
1337
  function wc_shortcodes_post_slider( $atts ) {
1338
  global $data;
1339
  global $post;
1345
  $atts = shortcode_atts( array(
1346
  'author' => '', //use author id
1347
  'author_name' => '', //use 'user_nicename' (NOT name).
1348
+ 'pids' => '', //use post id.
1349
+ 'p' => '', //use post id.
1350
+ 'post__in' => '', //use post ids
1351
  'order' => 'DESC', // DESC, ASC
1352
  'orderby' => 'date',
1353
  'post_status' => 'publish',
1360
  'field' => 'slug', // slug or id
1361
  'terms' => '', // taxonomy terms.
1362
 
1363
+ 'show_meta_category' => 1, // show heading?
1364
+ 'show_title' => 1, // show heading?
1365
+ 'show_content' => 1, // show main content?
1366
  'readmore' => 'Continue Reading', // show main content?
1367
  'button_class' => 'button', // show main content?
1368
 
1369
  'size' => 'full', // default thumbnail size
1370
 
1371
  'heading_type' => 'h2', // heading tag for title
1372
+ 'heading_size' => 30,
1373
+ 'mobile_heading_size' => 24,
1374
  'layout' => 'bxslider', // blog layout
1375
  'template' => 'slider1',
1376
+ 'excerpt_length' => 55,
1377
+ 'desktop_height' => 650,
1378
+ 'laptop_height' => 500,
1379
+ 'mobile_height' => 350,
1380
+
1381
+ 'slider_mode' => 'fade',
1382
+ 'slider_pause' => 4000,
1383
+ 'slider_auto' => 0,
1384
  ), $atts );
1385
 
1386
+ // sanitize bools
1387
+ $bools = array( 'ignore_sticky_posts', 'show_meta_category', 'show_title', 'show_content', 'slider_auto' );
1388
+ foreach ( $bools as $key ) {
1389
+ if ( isset( $atts[ $key ] ) ) {
1390
+ if ( "no" == $key ) {
1391
+ $atts[ $key ] = 0;
1392
+ }
1393
+ else {
1394
+ $atts[ $key ] = (bool) $atts[ $key ];
1395
+ $atts[ $key ] = $atts[ $key ] ? 1 : 0;
1396
+ }
1397
+ }
1398
+ }
1399
 
1400
+ // sanitize ints
1401
+ $ints = array( 'p', 'posts_per_page', 'heading_size', 'mobile_heading_size', 'excerpt_length', 'desktop_height', 'laptop_height', 'mobile_height', 'slider_pause' );
1402
+ foreach ( $ints as $key ) {
1403
+ if ( isset( $atts[ $key ] ) ) {
1404
+ $atts[ $key ] = (int) $atts[ $key ];
1405
+ }
1406
+ }
1407
+ $atts['slider_pause'] = abs( $atts['slider_pause'] );
1408
+
1409
+ $pids = explode( ',', $atts['pids'] );
1410
+ $p = array();
1411
+ if ( ! empty( $pids ) ) {
1412
+ foreach ( $pids as $id ) {
1413
+ $id = (int) $id;
1414
+ if ( ! empty( $id ) ) {
1415
+ $p[] = $id;
1416
+ }
1417
+ }
1418
 
1419
+ $size = sizeof( $p );
1420
+ if ( 1 < $size ) {
1421
+ $atts['p'] = '';
1422
+ $atts['post__in'] = $p;
1423
+ }
1424
+ else if ( 1 == $size ) {
1425
+ $atts['p'] = $p[0];
1426
+ $atts['post__in'] = '';
1427
+ }
1428
+ else {
1429
+ $atts['p'] = '';
1430
+ $atts['post__in'] = '';
1431
+ }
1432
  }
1433
 
1434
+
1435
+ // sanitize dropdown
1436
  $valid_layouts = array( 'bxslider' );
1437
+ if ( ! in_array( $atts['layout'], $valid_layouts ) ) {
1438
+ $atts['layout'] = 'bxslider';
1439
  }
1440
 
1441
  $valid_templates = array( 'slider1', 'slider2' );
1442
+ if ( ! in_array( $atts['template'], $valid_templates ) ) {
1443
+ $atts['template'] = 'slider1';
1444
  }
1445
 
1446
+ $valid_slider_modes = array( 'fade', 'vertical', 'horizontal' );
1447
+ if ( ! in_array( $atts['slider_mode'], $valid_slider_modes ) ) {
1448
+ $atts['slider_mode'] = 'fade';
 
 
1449
  }
 
 
 
 
1450
 
1451
+ $valid_orders = array( 'ASC', 'DESC' );
1452
+ $atts['order'] = strtoupper( $atts['order'] );
1453
+ if ( ! in_array( $atts['order'], $valid_orders ) ) {
1454
+ $atts['order'] = 'DESC';
1455
  }
1456
+
1457
+ $atts['heading_type'] = strtolower( $atts['heading_type'] );
1458
+ $valid_headings = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' );
1459
+ $atts['heading_type'] = in_array( $atts['heading_type'], $valid_headings ) ? $atts['heading_type'] : 'h2';
1460
+
1461
+ // sanitize inputs
1462
+ $atts['button_class'] = trim( $atts['button_class'] );
1463
+ $atts['button_class'] = empty( $atts['button_class'] ) ? 'wc-shortcodes-post-slide-button' : $atts['button_class'];
1464
+
1465
+ $terms = explode( ',', trim( $atts['terms'] ) );
1466
+ $t = array();
1467
+ if ( ! empty( $terms ) ) {
1468
+ foreach ( $terms as $term ) {
1469
+ $term = trim( $term );
1470
+ if ( ! empty( $term ) ) {
1471
+ $t[] = $term;
1472
+ }
1473
+ }
1474
+ $atts['terms'] = $t;
1475
  }
1476
 
1477
+ // fix bug with title argument being added to WP_Query() in 4.4
1478
+ $display_keys = array(
1479
+ 'show_meta_category', 'show_title', 'show_content', 'readmore', 'button_class', 'size', 'heading_type', 'heading_size', 'mobile_heading_size', 'layout', 'template', 'excerpt_length', 'desktop_height', 'laptop_height', 'mobile_height', 'slider_mode', 'slider_pause', 'slider_auto',
1480
+ );
1481
+ $display = array();
1482
+ foreach ( $display_keys as $key ) {
1483
+ $display[ $key ] = $atts[ $key ];
1484
+ unset( $atts[ $key ] );
1485
+ }
1486
 
1487
+ // remove not query keys
1488
+ unset( $atts[ 'pids' ] );
1489
 
1490
+ // check for get variable
1491
+ $wpc_term = null;
1492
+ if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
1493
+ $wpc_term = $_GET['wpc_term'];
1494
+ }
1495
 
1496
  // add tax query if user specified
1497
  if ( ! empty( $wpc_term ) ) {
1513
  );
1514
  }
1515
 
1516
+ // run query
1517
+ $wc_shortcodes_posts_query = new WP_Query($atts);
1518
+ $wc_shortcodes_posts_query->excerpt_length = $display['excerpt_length'];
 
 
 
 
 
1519
 
 
1520
 
1521
+ // enqueue scripts
1522
  if ( 'bxslider' == $display['layout'] ) {
1523
  wp_enqueue_script('wc-shortcodes-bxslider');
1524
  wp_enqueue_script('wc-shortcodes-post-slider');
1525
  }
1526
 
1527
+ // display
 
 
1528
  $html = '';
1529
 
1530
  $html .= '<style>';
1542
  $html .= '@media (max-width: 767px) {';
1543
  $html .= '#wc-shortcodes-post-slider-'.$instance.' .wc-shortcodes-post-slide {';
1544
  $html .= 'height: ' . $display['mobile_height'] . 'px;';
1545
+
1546
  $html .= '}';
1547
  $html .= '#wc-shortcodes-post-slider-'.$instance.' .wc-shortcodes-entry-title {';
1548
  $html .= 'font-size: ' . $display['mobile_heading_size'] . 'px;';
1557
  $class[] = 'wc-shortcodes-posts-template-' . $display['template'];
1558
 
1559
  $html .= '<div id="" class="wc-shortcodes-post-slider-wrapper">';
1560
+ $html .= '<div id="wc-shortcodes-post-slider-'.$instance.'" class="' . implode( ' ', $class ) . '" data-mode="' . $display['slider_mode'] . '" data-pause="' . $display['slider_pause'] . '" data-auto="' . $display['slider_auto'] . '">';
1561
 
1562
+ while( $wc_shortcodes_posts_query->have_posts() ) {
1563
+ $wc_shortcodes_posts_query->the_post();
1564
+
1565
+ if ( $display['show_content'] && empty( $post->post_excerpt ) && empty( $post->post_content ) )
1566
+ $display['show_content'] = false;
 
 
 
 
1567
 
1568
+ ob_start();
1569
+ include('templates/'.$display['template'].'/index.php');
1570
+ $html .= ob_get_clean();
1571
+ }
1572
 
1573
+ $html .= '</div>';
1574
  $html .= '</div>';
1575
 
1576
+ // reset query
1577
  wp_reset_query();
1578
+
1579
  return $html;
1580
  }
1581
  }
includes/templates/slider1/content.php CHANGED
@@ -9,27 +9,35 @@
9
 
10
  <div class="wc-shortcodes-post-slide-content">
11
  <div class="wc-shortcodes-post-slide-content-inner">
12
- <?php if ( $display['meta_category'] ) : ?>
13
  <?php echo wc_shortcodes_get_posted_category(); ?>
14
  <?php endif; ?>
15
 
16
- <?php if ( $display['title'] ) : ?>
17
- <div class="wc-shortcodes-entry-header">
18
- <<?php echo $display['heading_type']; ?> class="wc-shortcodes-entry-title">
19
- <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
20
- </<?php echo $display['heading_type']; ?>>
21
- </div><!-- .entry-header -->
22
  <?php endif; ?>
23
 
24
- <?php if ( $display['content'] ) : ?>
25
  <div class="wc-shortcodes-entry-summary">
26
  <?php wc_shortcodes_the_excerpt(); ?>
27
  </div><!-- .entry-summary -->
28
  <?php endif; ?>
29
 
30
  <?php if ( $display['readmore'] ) : ?>
 
 
 
 
 
 
 
 
31
  <div class="wc-shortcodes-read-more">
32
- <a class="<?php echo $display['button_class']; ?>" href="<?php the_permalink(); ?>"><?php echo $display['readmore']; ?></a>
33
  </div><!-- .entry-summary -->
34
  <?php endif; ?>
35
  </div>
9
 
10
  <div class="wc-shortcodes-post-slide-content">
11
  <div class="wc-shortcodes-post-slide-content-inner">
12
+ <?php if ( $display['show_meta_category'] ) : ?>
13
  <?php echo wc_shortcodes_get_posted_category(); ?>
14
  <?php endif; ?>
15
 
16
+ <?php if ( $display['show_title'] ) : ?>
17
+ <div class="wc-shortcodes-entry-header">
18
+ <<?php echo $display['heading_type']; ?> class="wc-shortcodes-entry-title">
19
+ <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
20
+ </<?php echo $display['heading_type']; ?>>
21
+ </div><!-- .entry-header -->
22
  <?php endif; ?>
23
 
24
+ <?php if ( $display['show_content'] ) : ?>
25
  <div class="wc-shortcodes-entry-summary">
26
  <?php wc_shortcodes_the_excerpt(); ?>
27
  </div><!-- .entry-summary -->
28
  <?php endif; ?>
29
 
30
  <?php if ( $display['readmore'] ) : ?>
31
+ <?php
32
+ if ( 'wcs_slide' == $post->post_type ) {
33
+ $url = get_post_meta( $post->ID, '_wc_shortcodes_slide_url', true );
34
+ }
35
+ else {
36
+ $url = get_the_permalink();
37
+ }
38
+ ?>
39
  <div class="wc-shortcodes-read-more">
40
+ <a class="<?php echo $display['button_class']; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
includes/templates/slider2/content.php CHANGED
@@ -9,11 +9,11 @@
9
 
10
  <div class="wc-shortcodes-post-slide-content">
11
  <div class="wc-shortcodes-post-slide-content-inner">
12
- <?php if ( $display['meta_category'] ) : ?>
13
  <?php echo wc_shortcodes_get_posted_category(); ?>
14
  <?php endif; ?>
15
 
16
- <?php if ( $display['title'] ) : ?>
17
  <div class="wc-shortcodes-entry-header">
18
  <<?php echo $display['heading_type']; ?> class="wc-shortcodes-entry-title">
19
  <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
@@ -21,15 +21,23 @@
21
  </div><!-- .entry-header -->
22
  <?php endif; ?>
23
 
24
- <?php if ( $display['content'] ) : ?>
25
  <div class="wc-shortcodes-entry-summary">
26
  <?php wc_shortcodes_the_excerpt(); ?>
27
  </div><!-- .entry-summary -->
28
  <?php endif; ?>
29
 
30
  <?php if ( $display['readmore'] ) : ?>
 
 
 
 
 
 
 
 
31
  <div class="wc-shortcodes-read-more">
32
- <a class="<?php echo $display['button_class']; ?>" href="<?php the_permalink(); ?>"><?php echo $display['readmore']; ?></a>
33
  </div><!-- .entry-summary -->
34
  <?php endif; ?>
35
  </div>
9
 
10
  <div class="wc-shortcodes-post-slide-content">
11
  <div class="wc-shortcodes-post-slide-content-inner">
12
+ <?php if ( $display['show_meta_category'] ) : ?>
13
  <?php echo wc_shortcodes_get_posted_category(); ?>
14
  <?php endif; ?>
15
 
16
+ <?php if ( $display['show_title'] ) : ?>
17
  <div class="wc-shortcodes-entry-header">
18
  <<?php echo $display['heading_type']; ?> class="wc-shortcodes-entry-title">
19
  <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
21
  </div><!-- .entry-header -->
22
  <?php endif; ?>
23
 
24
+ <?php if ( $display['show_content'] ) : ?>
25
  <div class="wc-shortcodes-entry-summary">
26
  <?php wc_shortcodes_the_excerpt(); ?>
27
  </div><!-- .entry-summary -->
28
  <?php endif; ?>
29
 
30
  <?php if ( $display['readmore'] ) : ?>
31
+ <?php
32
+ if ( 'wcs_slide' == $post->post_type ) {
33
+ $url = get_post_meta( $post->ID, '_wc_shortcodes_slide_url', true );
34
+ }
35
+ else {
36
+ $url = get_the_permalink();
37
+ }
38
+ ?>
39
  <div class="wc-shortcodes-read-more">
40
+ <a class="<?php echo $display['button_class']; ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $display['readmore']; ?></a>
41
  </div><!-- .entry-summary -->
42
  <?php endif; ?>
43
  </div>
includes/widgets.php CHANGED
@@ -9,6 +9,7 @@ All widget code should go here.
9
  function wc_shortcodes_register_widgets() {
10
  // Register social icons widget version 2
11
  register_widget('WC_Shortcodes_Social_Icons_Widget');
 
12
  }
13
  add_action('widgets_init', 'wc_shortcodes_register_widgets');
14
 
@@ -191,3 +192,324 @@ class WC_Shortcodes_Social_Icons_Widget extends WP_Widget {
191
  <?php
192
  }
193
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  function wc_shortcodes_register_widgets() {
10
  // Register social icons widget version 2
11
  register_widget('WC_Shortcodes_Social_Icons_Widget');
12
+ register_widget('WC_Shortcodes_Post_Slider_Widget');
13
  }
14
  add_action('widgets_init', 'wc_shortcodes_register_widgets');
15
 
192
  <?php
193
  }
194
  }
195
+
196
+ /**
197
+ * WC_Shortcodes_Post_Slider_Widget
198
+ *
199
+ * @uses WP
200
+ * @uses _Widget
201
+ */
202
+ class WC_Shortcodes_Post_Slider_Widget extends WP_Widget {
203
+ function __construct() {
204
+
205
+ $widget_ops = array( 'description' => __('Add a post slider to your widget area.') );
206
+ parent::__construct( 'wc_shortcodes_post_slider', __('Post Slider'), $widget_ops );
207
+ }
208
+
209
+ function widget($args, $instance) {
210
+ foreach ( $instance as $key => $value ) {
211
+ $shortcode[] = $key . '="' . $value . '"';
212
+ }
213
+
214
+ $shortcode = implode( " ", $shortcode );
215
+ $shortcode = '[wc_post_slider ' . $shortcode . '][/wc_post_slider]';
216
+
217
+ echo $args['before_widget'];
218
+ echo do_shortcode( $shortcode );
219
+ echo $args['after_widget'];
220
+ }
221
+
222
+ function update( $new_instance, $old_instance ) {
223
+ $instance['pids'] = $new_instance['pids'];
224
+ $instance['order'] = $new_instance['order'];
225
+ $instance['orderby'] = $new_instance['orderby'];
226
+ $instance['post_type'] = $new_instance['post_type'];
227
+ $instance['posts_per_page'] = (int) $new_instance['posts_per_page'];
228
+ $instance['ignore_sticky_posts'] = (int) $new_instance['ignore_sticky_posts'];
229
+ $instance['taxonomy'] = $new_instance['taxonomy'];
230
+ $instance['terms'] = $new_instance['terms'];
231
+ $instance['show_meta_category'] = (int) $new_instance['show_meta_category'];
232
+ $instance['show_title'] = (int) $new_instance['show_title'];
233
+ $instance['show_content'] = (int) $new_instance['show_content'];
234
+ $instance['readmore'] = $new_instance['readmore'];
235
+ $instance['button_class'] = strip_tags( stripslashes( $new_instance['button_class'] ) );
236
+ $instance['size'] = $new_instance['size'];
237
+ $instance['heading_type'] = $new_instance['heading_type'];
238
+ $instance['heading_size'] = (int) $new_instance['heading_size'];
239
+ $instance['mobile_heading_size'] = (int) $new_instance['mobile_heading_size'];
240
+ $instance['excerpt_length'] = (int) $new_instance['excerpt_length'];
241
+ $instance['desktop_height'] = (int) $new_instance['desktop_height'];
242
+ $instance['laptop_height'] = (int) $new_instance['laptop_height'];
243
+ $instance['mobile_height'] = (int) $new_instance['mobile_height'];
244
+ $instance['template'] = $new_instance['template'];
245
+ $instance['slider_mode'] = $new_instance['slider_mode'];
246
+ $instance['slider_pause'] = (int) $new_instance['slider_pause'];
247
+ $instance['slider_auto'] = (int) $new_instance['slider_auto'];
248
+
249
+ return $instance;
250
+ }
251
+
252
+ function form( $instance ) {
253
+ global $wc_shortcodes_widget_ops;
254
+
255
+ $pids = isset( $instance['pids'] ) ? $instance['pids'] : '';
256
+ $order = isset( $instance['order'] ) ? $instance['order'] : '';
257
+ $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
258
+ $post_type = isset( $instance['post_type'] ) ? $instance['post_type'] : 'post';
259
+ $posts_per_page = isset( $instance['posts_per_page'] ) ? $instance['posts_per_page'] : 10;
260
+ $ignore_sticky_posts = isset( $instance['ignore_sticky_posts'] ) ? $instance['ignore_sticky_posts'] : 1;
261
+ $taxonomy = isset( $instance['taxonomy'] ) ? $instance['taxonomy'] : '';
262
+ $terms = isset( $instance['terms'] ) ? $instance['terms'] : '';
263
+ $show_meta_category = isset( $instance['show_meta_category'] ) ? $instance['show_meta_category'] : 0;
264
+ $show_title = isset( $instance['show_title'] ) ? $instance['show_title'] : 1;
265
+ $show_content = isset( $instance['show_content'] ) ? $instance['show_content'] : 1;
266
+ $readmore = isset( $instance['readmore'] ) ? $instance['readmore'] : 'Coninue Reading';
267
+ $button_class = isset( $instance['button_class'] ) ? $instance['button_class'] : 'button secondary-button';
268
+ $size = isset( $instance['size'] ) ? $instance['size'] : 'full';
269
+ $heading_type = isset( $instance['heading_type'] ) ? $instance['heading_type'] : 'h2';
270
+ $heading_size = isset( $instance['heading_size'] ) ? $instance['heading_size'] : 24;
271
+ $mobile_heading_size = isset( $instance['mobile_heading_size'] ) ? $instance['mobile_heading_size'] : 24;
272
+ $excerpt_length = isset( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 30;
273
+ $desktop_height = isset( $instance['desktop_height'] ) ? $instance['desktop_height'] : 600;
274
+ $instance['desktop_height'] = '600';
275
+ $laptop_height = isset( $instance['laptop_height'] ) ? $instance['laptop_height'] : 500;
276
+ $mobile_height = isset( $instance['mobile_height'] ) ? $instance['mobile_height'] : 350;
277
+ $template = isset( $instance['template'] ) ? $instance['template'] : 'slider2';
278
+ $slider_mode = isset( $instance['slider_mode'] ) ? $instance['slider_mode'] : 'fade';
279
+ $slider_pause = isset( $instance['slider_pause'] ) ? $instance['slider_pause'] : 4000;
280
+ $slider_auto = isset( $instance['slider_auto'] ) ? $instance['slider_auto'] : 0;
281
+
282
+ $args = array(
283
+ 'public' => true,
284
+ );
285
+ $post_types = get_post_types( $args );
286
+ $slide_post_type = 'wcs_slide';
287
+ if ( post_type_exists( $slide_post_type ) ) {
288
+ $post_types[ $slide_post_type ] = $slide_post_type;
289
+ }
290
+ unset( $post_types['attachment'] );
291
+ ?>
292
+
293
+ <div id="wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>" class="wc-shortcodes-post-slider-widget">
294
+ <h3>Select Posts</h3>
295
+ <div>
296
+ <p>
297
+ <label for="<?php echo $this->get_field_id('pids'); ?>"><?php _e('Post IDs:') ?></label>
298
+ <input type="text" class="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 $pids; ?>" />
299
+ <span class="wcs-description">Leave blank to display all posts.</span>
300
+ </p>
301
+ <p>
302
+ <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order:'); ?></label>
303
+ <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
304
+ <?php
305
+ $options = array(
306
+ 'DESC' => 'DESC',
307
+ 'ASC' => 'ASC',
308
+ );
309
+ ?>
310
+ <?php foreach ( $options as $key => $value ) : ?>
311
+ <option value="<?php echo $key; ?>"<?php selected( $order, $key ); ?>><?php echo $value; ?></option>';
312
+ <?php endforeach; ?>
313
+ </select>
314
+ </p>
315
+ <p>
316
+ <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order By:'); ?></label>
317
+ <select id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
318
+ <?php
319
+ $options = array(
320
+ 'none' => 'No Order',
321
+ 'ID' => 'Post ID',
322
+ 'author' => 'Author',
323
+ 'title' => 'Title',
324
+ 'name' => 'Post Name',
325
+ 'type' => 'Post Type',
326
+ 'date' => 'Date',
327
+ 'modified' => 'Last Modified Date',
328
+ 'parent' => 'Post/Page Parent ID',
329
+ 'rand' => 'Random',
330
+ 'comment_count' => 'Number of Comments',
331
+ 'menu_order' => 'Menu Order',
332
+ 'post__in' => 'Preserve Post ID Order',
333
+ );
334
+ ?>
335
+ <?php foreach ( $options as $key => $value ) : ?>
336
+ <option value="<?php echo $key; ?>"<?php selected( $orderby, $key ); ?>><?php echo $value; ?></option>';
337
+ <?php endforeach; ?>
338
+ </select>
339
+ </p>
340
+ <p>
341
+ <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:'); ?></label>
342
+ <select id="<?php echo $this->get_field_id('post_type'); ?>" class="wc-shortcodes-widget-post-type-selector" name="<?php echo $this->get_field_name('post_type'); ?>">
343
+ <?php foreach ( $post_types as $key => $value ) : ?>
344
+ <option value="<?php echo $key; ?>"<?php selected( $post_type, $key ); ?>><?php echo $value; ?></option>';
345
+ <?php endforeach; ?>
346
+ </select>
347
+ </p>
348
+ <p>
349
+ <label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:'); ?></label>
350
+ <select id="<?php echo $this->get_field_id('taxonomy'); ?>" class="wc-shortcodes-widget-taxonomy-selector" name="<?php echo $this->get_field_name('taxonomy'); ?>">
351
+ <option value=""<?php selected( $taxonomy, "" ); ?>>No Taxonomy</option>';
352
+ <?php foreach ( $post_types as $post_type_name ) : ?>
353
+ <?php $taxonomies = get_object_taxonomies( $post_type_name, 'names' ); ?>
354
+ <?php if ( $taxonomies ) : ?>
355
+ <?php foreach ( $taxonomies as $key ) : ?>
356
+ <option value="<?php echo $key; ?>"<?php selected( $taxonomy, $key ); ?> data-post-type="<?php echo $post_type_name; ?>"><?php echo $key; ?></option>
357
+ <?php endforeach; ?>
358
+ <?php endif; ?>
359
+ <?php endforeach; ?>
360
+ </select>
361
+ </p>
362
+ <p>
363
+ <label for="<?php echo $this->get_field_id('terms'); ?>"><?php _e('Terms:') ?></label>
364
+ <input type="text" class="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 $terms; ?>" />
365
+ <span class="wcs-description">Leave blank to display all terms.</span>
366
+ </p>
367
+ <p>
368
+ <label for="<?php echo $this->get_field_id('posts_per_page'); ?>"><?php _e('Posts Per Page:') ?></label>
369
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('posts_per_page'); ?>" name="<?php echo $this->get_field_name('posts_per_page'); ?>" value="<?php echo $posts_per_page; ?>" />
370
+ <span class="wcs-description">Enter -1 for unlimited posts.</span>
371
+ </p>
372
+ <p>
373
+ <input type="checkbox" class="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( $ignore_sticky_posts, 1 ); ?> />
374
+ <label for="<?php echo $this->get_field_id('ignore_sticky_posts'); ?>"><?php _e('Ignore Sticky Posts') ?></label>
375
+ </p>
376
+ </div>
377
+ <h3>Content</h3>
378
+ <div>
379
+ <p>
380
+ <input type="checkbox" class="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( $show_meta_category, 1 ); ?> />
381
+ <label for="<?php echo $this->get_field_id('show_meta_category'); ?>"><?php _e('Show Meta Category') ?></label>
382
+ </p>
383
+ <p>
384
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_title'); ?>" name="<?php echo $this->get_field_name('show_title'); ?>" value="1" <?php checked( $show_title, 1 ); ?> />
385
+ <label for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title') ?></label>
386
+ </p>
387
+ <p>
388
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_content'); ?>" name="<?php echo $this->get_field_name('show_content'); ?>" value="1" <?php checked( $show_content, 1 ); ?> />
389
+ <label for="<?php echo $this->get_field_id('show_content'); ?>"><?php _e('Show Content') ?></label>
390
+ </p>
391
+ <p>
392
+ <label for="<?php echo $this->get_field_id('readmore'); ?>"><?php _e('Read More Text:') ?></label>
393
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('readmore'); ?>" name="<?php echo $this->get_field_name('readmore'); ?>" value="<?php echo $readmore; ?>" />
394
+ </p>
395
+ <p>
396
+ <label for="<?php echo $this->get_field_id('button_class'); ?>"><?php _e('Button Class:') ?></label>
397
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('button_class'); ?>" name="<?php echo $this->get_field_name('button_class'); ?>" value="<?php echo $button_class; ?>" />
398
+ </p>
399
+ <p>
400
+ <label for="<?php echo $this->get_field_id('size'); ?>"><?php _e('Image Size:'); ?></label>
401
+ <select id="<?php echo $this->get_field_id('size'); ?>" name="<?php echo $this->get_field_name('size'); ?>">
402
+ <?php
403
+ $sizes = apply_filters( 'image_size_names_choose', array(
404
+ 'thumbnail' => __('Thumbnail'),
405
+ 'medium' => __('Medium'),
406
+ 'large' => __('Large'),
407
+ 'full' => __('Full Size'),
408
+ ));
409
+ ?>
410
+ <?php foreach ( $sizes as $key => $value ) : ?>
411
+ <option value="<?php echo $key; ?>"<?php selected( $size, $key ); ?>><?php echo $value; ?></option>
412
+ <?php endforeach; ?>
413
+ </select>
414
+ </p>
415
+ <p>
416
+ <label for="<?php echo $this->get_field_id('heading_type'); ?>"><?php _e('Heading Type:'); ?></label>
417
+ <select id="<?php echo $this->get_field_id('heading_type'); ?>" name="<?php echo $this->get_field_name('heading_type'); ?>">
418
+ <?php
419
+ $options = array(
420
+ 'h1' => 'H1',
421
+ 'h2' => 'H2',
422
+ 'h3' => 'H3',
423
+ 'h4' => 'H4',
424
+ 'h5' => 'H5',
425
+ 'h6' => 'H6',
426
+ );
427
+ ?>
428
+ <?php foreach ( $options as $key => $value ) : ?>
429
+ <option value="<?php echo $key; ?>"<?php selected( $heading_type, $key ); ?>><?php echo $value; ?></option>';
430
+ <?php endforeach; ?>
431
+ </select>
432
+ </p>
433
+ </div>
434
+ <h3>Style</h3>
435
+ <div>
436
+ <p>
437
+ <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template:'); ?></label>
438
+ <select id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
439
+ <?php
440
+ $options = array(
441
+ 'slider1' => 'Slider 1',
442
+ 'slider2' => 'Slider 2',
443
+ );
444
+ ?>
445
+ <?php foreach ( $options as $key => $value ) : ?>
446
+ <option value="<?php echo $key; ?>"<?php selected( $template, $key ); ?>><?php echo $value; ?></option>';
447
+ <?php endforeach; ?>
448
+ </select>
449
+ </p>
450
+ <p>
451
+ <label for="<?php echo $this->get_field_id('heading_size'); ?>"><?php _e('Heading Size:') ?></label>
452
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('heading_size'); ?>" name="<?php echo $this->get_field_name('heading_size'); ?>" value="<?php echo $heading_size; ?>" />
453
+ </p>
454
+ <p>
455
+ <label for="<?php echo $this->get_field_id('mobile_heading_size'); ?>"><?php _e('Mobile Heading Size:') ?></label>
456
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('mobile_heading_size'); ?>" name="<?php echo $this->get_field_name('mobile_heading_size'); ?>" value="<?php echo $mobile_heading_size; ?>" />
457
+ </p>
458
+ <p>
459
+ <label for="<?php echo $this->get_field_id('excerpt_length'); ?>"><?php _e('Excerpt Length:') ?></label>
460
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('excerpt_length'); ?>" name="<?php echo $this->get_field_name('excerpt_length'); ?>" value="<?php echo $excerpt_length; ?>" />
461
+ </p>
462
+ <p>
463
+ <label for="<?php echo $this->get_field_id('desktop_height'); ?>"><?php _e('Desktop Height:') ?></label>
464
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('desktop_height'); ?>" name="<?php echo $this->get_field_name('desktop_height'); ?>" value="<?php echo $desktop_height; ?>" />
465
+ </p>
466
+ <p>
467
+ <label for="<?php echo $this->get_field_id('laptop_height'); ?>"><?php _e('Laptop Height:') ?></label>
468
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('laptop_height'); ?>" name="<?php echo $this->get_field_name('laptop_height'); ?>" value="<?php echo $laptop_height; ?>" />
469
+ </p>
470
+ <p>
471
+ <label for="<?php echo $this->get_field_id('mobile_height'); ?>"><?php _e('Mobile Height:') ?></label>
472
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('mobile_height'); ?>" name="<?php echo $this->get_field_name('mobile_height'); ?>" value="<?php echo $mobile_height; ?>" />
473
+ </p>
474
+ </div>
475
+ <h3>Slider Settings</h3>
476
+ <div>
477
+ <p>
478
+ <label for="<?php echo $this->get_field_id('slider_mode'); ?>"><?php _e('Slider Mode:'); ?></label>
479
+ <select id="<?php echo $this->get_field_id('slider_mode'); ?>" name="<?php echo $this->get_field_name('slider_mode'); ?>">
480
+ <?php
481
+ $options = array(
482
+ 'fade' => 'Fade',
483
+ 'horizontal' => 'Horizontal',
484
+ 'vertical' => 'Vertical',
485
+ );
486
+ ?>
487
+ <?php foreach ( $options as $key => $value ) : ?>
488
+ <option value="<?php echo $key; ?>"<?php selected( $slider_mode, $key ); ?>><?php echo $value; ?></option>';
489
+ <?php endforeach; ?>
490
+ </select>
491
+ </p>
492
+ <p>
493
+ <label for="<?php echo $this->get_field_id('slider_pause'); ?>"><?php _e('Slider Pause:') ?></label>
494
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('slider_pause'); ?>" name="<?php echo $this->get_field_name('slider_pause'); ?>" value="<?php echo $slider_pause; ?>" />
495
+ <span class="wcs-description">Enter number in milliseconds.</span>
496
+ </p>
497
+ <p>
498
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('slider_auto'); ?>" name="<?php echo $this->get_field_name('slider_auto'); ?>" value="1" <?php checked( $slider_auto, 1 ); ?> />
499
+ <label for="<?php echo $this->get_field_id('slider_auto'); ?>"><?php _e('Enable Auto Transition') ?></label>
500
+ </p>
501
+ </div>
502
+ </div>
503
+
504
+ <?php if ( '__i__' != $this->number ) : ?>
505
+ <script type="text/javascript">
506
+ /* <![CDATA[ */
507
+ jQuery(document).ready(function($){
508
+ $('#wc-shortcodes-post-slider-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content"}).wcPostSliderWidget();
509
+ });
510
+ /* ]]> */
511
+ </script>
512
+ <?php endif; ?>
513
+ <?php
514
+ }
515
+ }
readme.txt CHANGED
@@ -88,6 +88,11 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
91
  = Version 1.97 =
92
 
93
  * updated post slider style
88
 
89
  == Changelog ==
90
 
91
+ = Version 2.01 =
92
+
93
+ * improved post_slider shortcode
94
+ * added gui interface for post_slider shortcode
95
+
96
  = Version 1.97 =
97
 
98
  * updated post slider style
wc-shortcodes.php CHANGED
@@ -5,16 +5,17 @@ Plugin URI: http://webplantmedia.com/starter-themes/wordpresscanvas/features/sho
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 1.97
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '1.97' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
17
  define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
 
18
  define( 'WC_SHORTCODES_PLUGIN_BASENAME', plugin_basename( plugin_dir_path( realpath( __FILE__ ) ) . 'wc-shortcodes.php' ) );
19
 
20
  global $wc_shortcodes_options;
@@ -109,6 +110,10 @@ $wc_shortcodes_theme_support = array(
109
  require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
110
  require_once( dirname(__FILE__) . '/includes/options.php' ); // define options array
111
  require_once( dirname(__FILE__) . '/includes/functions.php' ); // Adds basic filters and actions
 
 
 
 
112
  require_once( dirname(__FILE__) . '/includes/scripts.php' ); // Adds plugin JS and CSS
113
  require_once( dirname(__FILE__) . '/includes/shortcode-functions.php'); // Main shortcode functions
114
  require_once( dirname(__FILE__) . '/includes/mce/shortcodes_tinymce.php'); // Add mce buttons to post editor
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 2.01
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( 'WC_SHORTCODES_VERSION', '2.01' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
17
  define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
18
+ define( 'WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_slide_post_type', true ) );
19
  define( 'WC_SHORTCODES_PLUGIN_BASENAME', plugin_basename( plugin_dir_path( realpath( __FILE__ ) ) . 'wc-shortcodes.php' ) );
20
 
21
  global $wc_shortcodes_options;
110
  require_once( plugin_dir_path( __FILE__ ) . 'includes/vendors/wpc-settings-framework/init.php' );
111
  require_once( dirname(__FILE__) . '/includes/options.php' ); // define options array
112
  require_once( dirname(__FILE__) . '/includes/functions.php' ); // Adds basic filters and actions
113
+ if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
114
+ require_once( dirname(__FILE__) . '/includes/post-types.php' ); // Adds basic filters and actions
115
+ }
116
+ require_once( dirname(__FILE__) . '/includes/ajax.php' ); // Adds basic filters and actions
117
  require_once( dirname(__FILE__) . '/includes/scripts.php' ); // Adds plugin JS and CSS
118
  require_once( dirname(__FILE__) . '/includes/shortcode-functions.php'); // Main shortcode functions
119
  require_once( dirname(__FILE__) . '/includes/mce/shortcodes_tinymce.php'); // Add mce buttons to post editor