Shortcodes by Angie Makes - Version 1.73

Version Description

Download this release

Release Info

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

Code changes from version 1.72 to 1.73

README.md CHANGED
@@ -66,6 +66,12 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
 
 
69
  ### Version 1.72
70
 
71
  * Fixed bug with post filtering
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 1.73
70
+
71
+ * Added support for navigation filter to also link to category pages if there is pagination.
72
+ * Improved speed when loading gallery format
73
+ * Code cleanup
74
+
75
  ### Version 1.72
76
 
77
  * Fixed bug with post filtering
includes/functions.php CHANGED
@@ -32,20 +32,20 @@ add_filter( 'plugin_action_links_' . WC_SHORTCODES_PLUGIN_BASENAME, 'wc_shortcod
32
  * @return void
33
  */
34
  function wc_shortcodes_smart_social_link( $social_link, $name ) {
35
- switch ( $name ) {
36
- case 'email' :
37
- // some users may have already inserted mailto:, so let's remove it.
38
  if ( is_email( $social_link ) ) {
39
  $social_link = str_replace( 'mailto:', '', $social_link );
40
  $social_link = 'mailto:'.$social_link;
41
  }
42
- break;
43
  default :
44
  $social_link = esc_url( $social_link );
45
  break;
46
- }
47
 
48
- return $social_link;
49
  }
50
  add_filter( 'wc_shortcodes_social_link' , 'wc_shortcodes_smart_social_link', 10, 2 );
51
 
@@ -83,68 +83,68 @@ function wc_shortcodes_default_social_icons() {
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' );
@@ -361,7 +361,7 @@ function wc_shortcodes_wp_trim_excerpt($text = '') {
361
  *
362
  * @since 2.8.0
363
  *
364
- * @param string $text The trimmed text.
365
  * @param string $raw_excerpt The text prior to trimming.
366
  */
367
  return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
32
  * @return void
33
  */
34
  function wc_shortcodes_smart_social_link( $social_link, $name ) {
35
+ switch ( $name ) {
36
+ case 'email' :
37
+ // some users may have already inserted mailto:, so let's remove it.
38
  if ( is_email( $social_link ) ) {
39
  $social_link = str_replace( 'mailto:', '', $social_link );
40
  $social_link = 'mailto:'.$social_link;
41
  }
42
+ break;
43
  default :
44
  $social_link = esc_url( $social_link );
45
  break;
46
+ }
47
 
48
+ return $social_link;
49
  }
50
  add_filter( 'wc_shortcodes_social_link' , 'wc_shortcodes_smart_social_link', 10, 2 );
51
 
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' );
361
  *
362
  * @since 2.8.0
363
  *
364
+ * @param string $text The trimmed text.
365
  * @param string $raw_excerpt The text prior to trimming.
366
  */
367
  return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
includes/js/posts-grid.js CHANGED
@@ -26,7 +26,7 @@
26
  });
27
  });
28
 
29
- var $filterNav = $('.wc-shortcodes-filtering.wc-shortcodes-filtering-layout-grid');
30
  var $term = $filterNav.find('.wc-shortcodes-term');
31
  $term.click( function( event ) {
32
  event.preventDefault();
@@ -37,8 +37,8 @@
37
  var selector = $(this).attr('data-filter');
38
  var target = $filterNav.data('target');
39
  var $target = $(target);
 
40
  $target.animate({opacity: 0}, 300, function() {
41
- var $targetPosts = $target.children('.wc-shortcodes-post-box');
42
  if ( '*' == selector ) {
43
  $targetPosts.show();
44
  }
26
  });
27
  });
28
 
29
+ var $filterNav = $('.wc-shortcodes-filtering.wc-shortcodes-filtering-dynamic.wc-shortcodes-filtering-layout-grid');
30
  var $term = $filterNav.find('.wc-shortcodes-term');
31
  $term.click( function( event ) {
32
  event.preventDefault();
37
  var selector = $(this).attr('data-filter');
38
  var target = $filterNav.data('target');
39
  var $target = $(target);
40
+ var $targetPosts = $target.children('.wc-shortcodes-post-box');
41
  $target.animate({opacity: 0}, 300, function() {
 
42
  if ( '*' == selector ) {
43
  $targetPosts.show();
44
  }
includes/js/posts.js CHANGED
@@ -114,7 +114,7 @@
114
  });
115
  });
116
 
117
- var $filterNav = $('.wc-shortcodes-filtering.wc-shortcodes-filtering-layout-masonry');
118
  var $term = $filterNav.find('.wc-shortcodes-term');
119
  $term.click( function( event ) {
120
  event.preventDefault();
114
  });
115
  });
116
 
117
+ var $filterNav = $('.wc-shortcodes-filtering.wc-shortcodes-filtering-dynamic.wc-shortcodes-filtering-layout-masonry');
118
  var $term = $filterNav.find('.wc-shortcodes-term');
119
  $term.click( function( event ) {
120
  event.preventDefault();
includes/shortcode-functions.php CHANGED
@@ -1174,6 +1174,10 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1174
 
1175
  // clean input values
1176
  $atts['terms'] = wc_shortcodes_comma_delim_to_array( $atts['terms'] );
 
 
 
 
1177
  $atts['post__in'] = wc_shortcodes_comma_delim_to_array( $atts['post__in'] );
1178
  $atts['columns'] == (int) $atts['columns'];
1179
  $atts['excerpt_length'] = (int) $atts['excerpt_length'];
@@ -1201,7 +1205,16 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1201
 
1202
 
1203
  // add tax query if user specified
1204
- if ( ! empty( $atts['terms'] ) ) {
 
 
 
 
 
 
 
 
 
1205
  $atts['tax_query'] = array(
1206
  array(
1207
  'taxonomy' => $atts['taxonomy'],
@@ -1230,10 +1243,15 @@ if( ! function_exists( 'wc_shortcodes_posts' ) ) {
1230
  ($atts['meta_comments'] == "yes") ? ($atts['meta_comments'] = true) : ($atts['meta_comments'] = false);
1231
  ($atts['thumbnail'] == "yes") ? ($atts['thumbnail'] = true) : ($atts['thumbnail'] = false);
1232
  ($atts['content'] == "yes") ? ($atts['content'] = true) : ($atts['content'] = false);
1233
- ($atts['paging'] == "yes") ? ($atts['paging'] = true) : ($atts['paging'] = false);
1234
  ($atts['filtering'] == "yes") ? ($atts['filtering'] = true) : ($atts['filtering'] = false);
1235
  ($atts['order'] == "ASC") ? ($atts['order'] = "ASC") : ($atts['order'] = "DESC");
1236
 
 
 
 
 
 
1237
  $wc_shortcodes_posts_query = new WP_Query($atts);
1238
  $wc_shortcodes_posts_query->excerpt_length = $atts['excerpt_length'];
1239
 
1174
 
1175
  // clean input values
1176
  $atts['terms'] = wc_shortcodes_comma_delim_to_array( $atts['terms'] );
1177
+ $wpc_terms = null;
1178
+ if ( isset( $_GET['wpc_terms'] ) && ! empty( $_GET['wpc_terms'] ) ) {
1179
+ $wpc_terms = $_GET['wpc_terms'];
1180
+ }
1181
  $atts['post__in'] = wc_shortcodes_comma_delim_to_array( $atts['post__in'] );
1182
  $atts['columns'] == (int) $atts['columns'];
1183
  $atts['excerpt_length'] = (int) $atts['excerpt_length'];
1205
 
1206
 
1207
  // add tax query if user specified
1208
+ if ( ! empty( $wpc_terms ) ) {
1209
+ $atts['tax_query'] = array(
1210
+ array(
1211
+ 'taxonomy' => $atts['taxonomy'],
1212
+ 'field' => $atts['field'],
1213
+ 'terms' => $wpc_terms,
1214
+ ),
1215
+ );
1216
+ }
1217
+ else if ( ! empty( $atts['terms'] ) ) {
1218
  $atts['tax_query'] = array(
1219
  array(
1220
  'taxonomy' => $atts['taxonomy'],
1243
  ($atts['meta_comments'] == "yes") ? ($atts['meta_comments'] = true) : ($atts['meta_comments'] = false);
1244
  ($atts['thumbnail'] == "yes") ? ($atts['thumbnail'] = true) : ($atts['thumbnail'] = false);
1245
  ($atts['content'] == "yes") ? ($atts['content'] = true) : ($atts['content'] = false);
1246
+ ($atts['paging'] == "yes" && ! $atts['nopaging']) ? ($atts['paging'] = true) : ($atts['paging'] = false);
1247
  ($atts['filtering'] == "yes") ? ($atts['filtering'] = true) : ($atts['filtering'] = false);
1248
  ($atts['order'] == "ASC") ? ($atts['order'] = "ASC") : ($atts['order'] = "DESC");
1249
 
1250
+ $nav_filter_hard_links = false;
1251
+ if ( $atts['paging'] ) {
1252
+ $nav_filter_hard_links = true;
1253
+ }
1254
+
1255
  $wc_shortcodes_posts_query = new WP_Query($atts);
1256
  $wc_shortcodes_posts_query->excerpt_length = $atts['excerpt_length'];
1257
 
includes/templates/box/content-gallery.php CHANGED
@@ -1,8 +1,7 @@
1
  <?php $classes[] = 'wc-shortcodes-post-box'; ?>
2
  <div id="post-<?php the_ID(); ?>" <?php post_class( $classes ); ?>>
3
  <div class="wc-shortcodes-post-border">
4
- <?php if ( get_post_gallery() ) : ?>
5
- <?php $gallery = get_post_gallery( get_the_ID(), false ); ?>
6
 
7
  <div class="rslides-wrapper">
8
  <ul class="rslides">
1
  <?php $classes[] = 'wc-shortcodes-post-box'; ?>
2
  <div id="post-<?php the_ID(); ?>" <?php post_class( $classes ); ?>>
3
  <div class="wc-shortcodes-post-border">
4
+ <?php if ( $gallery = get_post_gallery( get_the_ID(), false ) ) : ?>
 
5
 
6
  <div class="rslides-wrapper">
7
  <ul class="rslides">
includes/templates/nav-filtering.php CHANGED
@@ -1,9 +1,14 @@
1
  <?php
 
 
 
 
2
  $args = array(
3
  'orderby' => 'name',
4
  );
5
  $taxonomy = $atts['taxonomy'];
6
  $whitelist = $atts['terms'];
 
7
 
8
  if ( ! empty( $taxonomy ) ) {
9
  $terms = get_terms( $taxonomy, $args );
@@ -11,28 +16,29 @@ if ( ! empty( $taxonomy ) ) {
11
  if ( ! is_wp_error( $terms ) || empty( $terms ) ) {
12
 
13
  $links = array();
14
- $links[] = "<a href='#' data-filter='*' title='All Tags' class='wc-shortcodes-term wc-shortcodes-all-tags wc-shortcodes-term-active'>" . __( 'All', 'wordpresscanvas' ) . "</a>";
 
15
 
16
  if ( ! is_array( $whitelist ) || empty( $whitelist ) ) {
17
  foreach ( $terms as $term ) {
18
- $term_link = get_term_link( $term );
19
 
20
- $links[] = "<a href='#' data-filter='.wc-shortcodes-filter-{$term->slug}' title='{$term->name} Tag' class='wc-shortcodes-term wc-shortcodes-term-slug-{$term->slug}'>" . $term->name . "</a>";
21
  }
22
  }
23
  else {
24
  foreach ( $terms as $term ) {
25
  if ( in_array( $term->slug, $whitelist ) ) {
26
- $term_link = get_term_link( $term );
27
 
28
- $links[] = "<a href='#' data-filter='.wc-shortcodes-filter-{$term->slug}' title='{$term->name} Tag' class='wc-shortcodes-term wc-shortcodes-term-slug-{$term->slug}'>" . $term->name . "</a>";
29
  }
30
  }
31
  }
32
  ?>
33
 
34
  <?php if ( sizeof( $links ) > 2 ) : ?>
35
- <nav data-target="#wc-shortcodes-posts-<?php echo $instance; ?>" class="wc-shortcodes-filtering wc-shortcodes-filtering-layout-<?php echo $atts['layout']; ?> wc-shortcodes-nav-<?php echo $taxonomy; ?>">
36
  <?php echo implode( "<span class='tag-divider'>/</span>", $links ); ?>
37
  </nav>
38
  <?php endif; ?>
1
  <?php
2
+ $nav_filter_class = '';
3
+ if ( ! $nav_filter_hard_links ) {
4
+ $nav_filter_class = ' wc-shortcodes-filtering-dynamic';
5
+ }
6
  $args = array(
7
  'orderby' => 'name',
8
  );
9
  $taxonomy = $atts['taxonomy'];
10
  $whitelist = $atts['terms'];
11
+ $permalink = get_permalink();
12
 
13
  if ( ! empty( $taxonomy ) ) {
14
  $terms = get_terms( $taxonomy, $args );
16
  if ( ! is_wp_error( $terms ) || empty( $terms ) ) {
17
 
18
  $links = array();
19
+ $link = $nav_filter_hard_links ? $permalink : '#';
20
+ $links[] = "<a href='{$link}' data-filter='*' title='All Tags' class='wc-shortcodes-term wc-shortcodes-all-tags wc-shortcodes-term-active'>" . __( 'All', 'wordpresscanvas' ) . "</a>";
21
 
22
  if ( ! is_array( $whitelist ) || empty( $whitelist ) ) {
23
  foreach ( $terms as $term ) {
24
+ $link = $nav_filter_hard_links ? $permalink . '?wpc_terms=' . $term->slug : '#';
25
 
26
+ $links[] = "<a href='{$link}' data-filter='.wc-shortcodes-filter-{$term->slug}' title='{$term->name} Tag' class='wc-shortcodes-term wc-shortcodes-term-slug-{$term->slug}'>" . $term->name . "</a>";
27
  }
28
  }
29
  else {
30
  foreach ( $terms as $term ) {
31
  if ( in_array( $term->slug, $whitelist ) ) {
32
+ $link = $nav_filter_hard_links ? $permalink . '?wpc_terms=' . $term->slug : '#';
33
 
34
+ $links[] = "<a href='{$link}' data-filter='.wc-shortcodes-filter-{$term->slug}' title='{$term->name} Tag' class='wc-shortcodes-term wc-shortcodes-term-slug-{$term->slug}'>" . $term->name . "</a>";
35
  }
36
  }
37
  }
38
  ?>
39
 
40
  <?php if ( sizeof( $links ) > 2 ) : ?>
41
+ <nav data-target="#wc-shortcodes-posts-<?php echo $instance; ?>" class="wc-shortcodes-filtering<?php echo $nav_filter_class; ?> wc-shortcodes-filtering-layout-<?php echo $atts['layout']; ?> wc-shortcodes-nav-<?php echo $taxonomy; ?>">
42
  <?php echo implode( "<span class='tag-divider'>/</span>", $links ); ?>
43
  </nav>
44
  <?php endif; ?>
readme.txt CHANGED
@@ -88,6 +88,12 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
91
  = Version 1.72 =
92
 
93
  * Fixed bug with post filtering
88
 
89
  == Changelog ==
90
 
91
+ = Version 1.73 =
92
+
93
+ * Added support for navigation filter to also link to category pages if there is pagination.
94
+ * Improved speed when loading gallery format
95
+ * Code cleanup
96
+
97
  = Version 1.72 =
98
 
99
  * Fixed bug with post filtering
wc-shortcodes.php CHANGED
@@ -5,11 +5,11 @@ 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.72
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '1.72' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.73
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( 'WC_SHORTCODES_VERSION', '1.73' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );