The Events Calendar Shortcode - Version 1.7

Version Description

  • Adds structured data to the shortcode output (great for SEO and people finding your events)
Download this release

Release Info

Developer brianhogg
Plugin Icon 128x128 The Events Calendar Shortcode
Version 1.7
Comparing to
See all releases

Code changes from version 1.6.1 to 1.7

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: brianhogg
3
  Tags: event, events, calendar, shortcode, modern tribe
4
  Requires at least: 4.1
5
  Tested up to: 4.8
6
- Stable tag: 1.6.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -124,6 +124,7 @@ You can put the shortcode in a text widget, though not all themes support use of
124
  If a regular text widget doesn't work, put the shortcode in a <a href="https://wordpress.org/plugins/black-studio-tinymce-widget/">Visual Editor Widget</a>.
125
 
126
  = What are the classes for styling the list of events? =
 
127
  By default the plugin does not include styling. Events are listed in ul li tags with appropriate classes for styling with a bit of CSS.
128
 
129
  * ul class="ecs-event-list"
@@ -154,6 +155,9 @@ The [pro version of the plugin](https://eventcalendarnewsletter.com/the-events-c
154
 
155
  == Upgrade Notice ==
156
 
 
 
 
157
  = 1.6.1 =
158
  * Added ecs-featured-event class if event is featured
159
  * Internal changes to filtering by one or more categories
@@ -223,6 +227,9 @@ Fix missing ul
223
 
224
  == Changelog ==
225
 
 
 
 
226
  = 1.6.1 =
227
  * Added ecs-featured-event class if event is featured
228
  * Internal changes to filtering by one or more categories
3
  Tags: event, events, calendar, shortcode, modern tribe
4
  Requires at least: 4.1
5
  Tested up to: 4.8
6
+ Stable tag: 1.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
124
  If a regular text widget doesn't work, put the shortcode in a <a href="https://wordpress.org/plugins/black-studio-tinymce-widget/">Visual Editor Widget</a>.
125
 
126
  = What are the classes for styling the list of events? =
127
+
128
  By default the plugin does not include styling. Events are listed in ul li tags with appropriate classes for styling with a bit of CSS.
129
 
130
  * ul class="ecs-event-list"
155
 
156
  == Upgrade Notice ==
157
 
158
+ = 1.7 =
159
+ * Adds structured data to the shortcode output (great for SEO and people finding your events)
160
+
161
  = 1.6.1 =
162
  * Added ecs-featured-event class if event is featured
163
  * Internal changes to filtering by one or more categories
227
 
228
  == Changelog ==
229
 
230
+ = 1.7 =
231
+ * Adds structured data to the shortcode output (great for SEO and people finding your events)
232
+
233
  = 1.6.1 =
234
  * Added ecs-featured-event class if event is featured
235
  * Internal changes to filtering by one or more categories
static/the-events-calendar-shortcode-calendar-demo.gif ADDED
Binary file
static/the-events-calendar-shortcode-calendar-design.gif DELETED
Binary file
static/the-events-calendar-shortcode-columns-photo-horizontal-design.png ADDED
Binary file
templates/admin-page.php CHANGED
@@ -43,9 +43,9 @@
43
  <h3>thumb</h3>
44
  <p><?php echo esc_html( __( 'To show or hide thumbnail/featured image. Default is false.', 'the-events-calendar-shortcode' ) ); ?></p>
45
  <blockquote>[ecs-list-events thumb='true']</blockquote>
46
- <p><?php echo esc_html( __( 'You can use 2 other attributes: thumbwidth and thumbheight to customize the thumbnail size', 'the-events-calendar-shortcode' ) ); ?></p>
47
  <blockquote>[ecs-list-events thumb='true' thumbwidth='150' thumbheight='150']</blockquote>
48
- <p><?php echo esc_html( __( 'or use thumbsize to specify the pre-set size to use, for example:', 'the-events-calendar-shortcode' ) ); ?></p>
49
  <blockquote>[ecs-list-events thumb='true' thumbsize='large']</blockquote>
50
 
51
  <h3>message</h3>
@@ -101,8 +101,9 @@
101
  <div id="ecs-pro-designs">
102
  <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-1&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/shortcode-default-design-2.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version default design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
103
  <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-2&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/event-calendar-shortcode-compact-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version compact design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
104
- <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-grouped&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-grouped-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version grouped design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
105
- <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-calendar&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-calendar-design.gif', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version calendar design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
 
106
  </div>
107
 
108
  <h3 class="additional-options"><?php echo esc_html__( "In addition to designs, you'll get more options including:", 'the-events-calendar-shortcode' ); ?></h3>
@@ -130,8 +131,7 @@
130
  <p><?php echo esc_html__( 'Only show events in the future even when using the month or year option.', 'the-events-calendar-shortcode' ) ?></p>
131
  <h4><?php echo esc_html__( 'Custom Design', 'the-events-calendar-shortcode' ) ?></h4>
132
  <p><?php echo esc_html__( 'Use the new default or compact designs, or create your own using one or more templates in your theme folder', 'the-events-calendar-shortcode' ) ?></p>
133
- <p><?php echo sprintf( esc_html__( '%sGet The Events Calendar Shortcode PRO%s', 'the-events-calendar-shortcode' ), '<a class="ecs-button" target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-after-options&utm_content=description">', '</a>' ); ?></p>
134
-
135
  </div>
136
  <?php endif; ?>
137
  </td>
43
  <h3>thumb</h3>
44
  <p><?php echo esc_html( __( 'To show or hide thumbnail/featured image. Default is false.', 'the-events-calendar-shortcode' ) ); ?></p>
45
  <blockquote>[ecs-list-events thumb='true']</blockquote>
46
+ <p><?php echo sprintf( esc_html( __( 'You can use 2 other attributes: %s and %s to customize the thumbnail size', 'the-events-calendar-shortcode' ) ), 'thumbwidth', 'thumbheight' ); ?></p>
47
  <blockquote>[ecs-list-events thumb='true' thumbwidth='150' thumbheight='150']</blockquote>
48
+ <p><?php echo sprintf( esc_html( __( 'or use %s to specify the pre-set size to use, for example:', 'the-events-calendar-shortcode' ) ), 'thumbsize' ); ?></p>
49
  <blockquote>[ecs-list-events thumb='true' thumbsize='large']</blockquote>
50
 
51
  <h3>message</h3>
101
  <div id="ecs-pro-designs">
102
  <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-1&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/shortcode-default-design-2.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version default design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
103
  <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-2&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/event-calendar-shortcode-compact-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version compact design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
104
+ <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-calendar&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-calendar-demo.gif', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version calendar design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
105
+ <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-columns&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-columns-photo-horizontal-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version horizontal/columns/photos design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
106
+ <p><a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design-image-grouped&utm_content=description"><img alt="" style="width: 300px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-grouped-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br><?php echo esc_html( __( 'Pro version grouped design example', 'the-events-calendar-shortcode' ) ); ?></a></p>
107
  </div>
108
 
109
  <h3 class="additional-options"><?php echo esc_html__( "In addition to designs, you'll get more options including:", 'the-events-calendar-shortcode' ); ?></h3>
131
  <p><?php echo esc_html__( 'Only show events in the future even when using the month or year option.', 'the-events-calendar-shortcode' ) ?></p>
132
  <h4><?php echo esc_html__( 'Custom Design', 'the-events-calendar-shortcode' ) ?></h4>
133
  <p><?php echo esc_html__( 'Use the new default or compact designs, or create your own using one or more templates in your theme folder', 'the-events-calendar-shortcode' ) ?></p>
134
+ <p><?php echo sprintf( esc_html__( '%sGet The Events Calendar Shortcode PRO%s', 'the-events-calendar-shortcode' ), '<a class="ecs-button" target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-after-options&utm_content=description">', '</a>' ); ?> or <a href="https://demo.eventcalendarnewsletter.com/the-events-calendar-shortcode/">see it in action</p>
 
135
  </div>
136
  <?php endif; ?>
137
  </td>
the-events-calendar-shortcode.php CHANGED
@@ -2,11 +2,11 @@
2
  /***
3
  Plugin Name: The Events Calendar Shortcode
4
  Plugin URI: https://eventcalendarnewsletter.com/the-events-calendar-shortcode/
5
- Description: An addon to add shortcode functionality for <a href="http://wordpress.org/plugins/the-events-calendar/">The Events Calendar Plugin (Free Version) by Modern Tribe</a>.
6
- Version: 1.6.1
7
  Author: Event Calendar Newsletter
8
- Author URI: https://eventcalendarnewsletter.com/the-events-calendar-shortcode/
9
- Contributors: Brainchild Media Group, Reddit user miahelf, tallavic, hejeva2
10
  License: GPL2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Text Domain: the-events-calendar-shortcode
@@ -38,7 +38,7 @@ class Events_Calendar_Shortcode
38
  *
39
  * @since 1.0.0
40
  */
41
- const VERSION = '1.6.1';
42
 
43
  private $admin_page = null;
44
 
@@ -57,6 +57,7 @@ class Events_Calendar_Shortcode
57
  add_action( 'admin_menu', array( $this, 'add_menu_page' ), 1000 );
58
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_action_links' ) );
59
  add_shortcode( 'ecs-list-events', array( $this, 'ecs_fetch_events' ) );
 
60
  add_action( 'plugins_loaded', array( $this, 'load_languages' ) );
61
 
62
  } // END __construct()
@@ -77,7 +78,7 @@ class Events_Calendar_Shortcode
77
  if ( current_user_can( 'activate_plugins' ) ) {
78
  $url = 'plugin-install.php?tab=plugin-information&plugin=the-events-calendar&TB_iframe=true';
79
  $title = __( 'The Events Calendar', 'tribe-events-ical-importer' );
80
- echo '<div class="error"><p>' . sprintf( esc_html( __( 'To begin using The Events Calendar Shortcode, please install the latest version of %sThe Events Calendar%s and add an event.', 'the-events-calendar-shortcode' ) ), '<a href="' . esc_url( $url ) . '" class="thickbox" title="' . esc_attr( $title ) . '">', '</a>' ) . '</p></div>';
81
  }
82
  }
83
 
@@ -258,11 +259,12 @@ class Events_Calendar_Shortcode
258
  'meta_query' => apply_filters( 'ecs_get_meta_query', array( $atts['meta_date'] ), $atts, $meta_date_date, $meta_date_compare ),
259
  ), $atts, $meta_date_date, $meta_date_compare ) );
260
 
261
- if ( $posts ) {
 
262
  $output .= apply_filters( 'ecs_start_tag', '<ul class="ecs-event-list">', $atts );
263
  $atts['contentorder'] = explode( ',', $atts['contentorder'] );
264
 
265
- foreach( $posts as $post ) {
266
  setup_postdata( $post );
267
  $event_output = '';
268
  $category_slugs = array();
@@ -340,6 +342,7 @@ class Events_Calendar_Shortcode
340
  $output .= apply_filters( 'ecs_single_event_output', $event_output, $atts, $post );
341
  }
342
  $output .= apply_filters( 'ecs_end_tag', '</ul>', $atts );
 
343
 
344
  if( self::isValid( $atts['viewall'] ) ) {
345
  $output .= apply_filters( 'ecs_view_all_events_tag_start', '<span class="ecs-all-events">', $atts ) .
@@ -356,6 +359,12 @@ class Events_Calendar_Shortcode
356
  return $output;
357
  }
358
 
 
 
 
 
 
 
359
  /**
360
  * Checks if the plugin attribute is valid
361
  *
2
  /***
3
  Plugin Name: The Events Calendar Shortcode
4
  Plugin URI: https://eventcalendarnewsletter.com/the-events-calendar-shortcode/
5
+ Description: An addon to add shortcode functionality for <a href="http://wordpress.org/plugins/the-events-calendar/">The Events Calendar Plugin by Modern Tribe</a>.
6
+ Version: 1.7
7
  Author: Event Calendar Newsletter
8
+ Author URI: https://eventcalendarnewsletter.com/the-events-calendar-shortcode
9
+ Contributors: brianhogg
10
  License: GPL2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Text Domain: the-events-calendar-shortcode
38
  *
39
  * @since 1.0.0
40
  */
41
+ const VERSION = '1.7';
42
 
43
  private $admin_page = null;
44
 
57
  add_action( 'admin_menu', array( $this, 'add_menu_page' ), 1000 );
58
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_action_links' ) );
59
  add_shortcode( 'ecs-list-events', array( $this, 'ecs_fetch_events' ) );
60
+ add_filter( 'ecs_ending_output', array( $this, 'add_event_schema_json' ), 10, 3 );
61
  add_action( 'plugins_loaded', array( $this, 'load_languages' ) );
62
 
63
  } // END __construct()
78
  if ( current_user_can( 'activate_plugins' ) ) {
79
  $url = 'plugin-install.php?tab=plugin-information&plugin=the-events-calendar&TB_iframe=true';
80
  $title = __( 'The Events Calendar', 'tribe-events-ical-importer' );
81
+ echo '<div class="error"><p>' . sprintf( esc_html( __( 'To begin using %s, please install the latest version of %s%s%s and add an event.', 'the-events-calendar-shortcode' ) ), 'The Events Calendar Shortcode', '<a href="' . esc_url( $url ) . '" class="thickbox" title="' . esc_attr( $title ) . '">', 'The Events Calendar', '</a>' ) . '</p></div>';
82
  }
83
  }
84
 
259
  'meta_query' => apply_filters( 'ecs_get_meta_query', array( $atts['meta_date'] ), $atts, $meta_date_date, $meta_date_compare ),
260
  ), $atts, $meta_date_date, $meta_date_compare ) );
261
 
262
+ if ( $posts or apply_filters( 'ecs_always_show', false, $atts ) ) {
263
+ $output = apply_filters( 'ecs_beginning_output', $output, $posts, $atts );
264
  $output .= apply_filters( 'ecs_start_tag', '<ul class="ecs-event-list">', $atts );
265
  $atts['contentorder'] = explode( ',', $atts['contentorder'] );
266
 
267
+ foreach( (array) $posts as $post ) {
268
  setup_postdata( $post );
269
  $event_output = '';
270
  $category_slugs = array();
342
  $output .= apply_filters( 'ecs_single_event_output', $event_output, $atts, $post );
343
  }
344
  $output .= apply_filters( 'ecs_end_tag', '</ul>', $atts );
345
+ $output = apply_filters( 'ecs_ending_output', $output, $posts, $atts );
346
 
347
  if( self::isValid( $atts['viewall'] ) ) {
348
  $output .= apply_filters( 'ecs_view_all_events_tag_start', '<span class="ecs-all-events">', $atts ) .
359
  return $output;
360
  }
361
 
362
+ public function add_event_schema_json( $output, $posts, $atts ) {
363
+ if ( $posts and class_exists( 'Tribe__Events__JSON_LD__Event' ) and ( ! defined( 'DOING_AJAX' ) or ! DOING_AJAX ) )
364
+ $output .= Tribe__Events__JSON_LD__Event::instance()->get_markup( $posts );
365
+ return $output;
366
+ }
367
+
368
  /**
369
  * Checks if the plugin attribute is valid
370
  *