The Events Calendar Shortcode - Version 1.4.1

Version Description

  • Additional filters for formatting a single event
Download this release

Release Info

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

Code changes from version 1.4 to 1.4.1

readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: brianhogg, dandelionweb, ankitpokhrel, sujin2f
3
  Tags: event, events, calendar, shortcode, modern tribe
4
  Requires at least: 4.0
5
- Tested up to: 4.7.1
6
- Stable tag: 1.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -24,8 +24,9 @@ With this plugin, just add the shortcode on a page to display a list of your eve
24
  * order - Order of the events to be shown. Value can be 'ASC' or 'DESC'. Default is 'ASC'. Order is based on event date. [ecs-list-events order='DESC']
25
  * date - To show or hide date. Value can be 'true' or 'false'. Default is true. [ecs-list-events eventdetails='false']
26
  * venue - To show or hide the venue. Value can be 'true' or 'false'. Default is false. [ecs-list-events venue='true']
27
- * excerpt - To show or hide the excerpt and set excerpt length. Default is false. [ecs-list-events excerpt='true'] //displays excerpt with length 100
28
- * excerpt='300' //displays excerpt with length 300
 
29
  * thumb - To show or hide thumbnail image. Default is false. [ecs-list-events thumb='true'] //displays post thumbnail in default thumbnail dimension from media settings.
30
  * You can use 2 other attributes: thumbwidth and thumbheight to customize the thumbnail size [ecs-list-events thumb='true' thumbwidth='150' thumbheight='150']
31
  * message - Message to show when there are no events. Defaults to 'There are no upcoming events at this time.'
@@ -35,10 +36,18 @@ With this plugin, just add the shortcode on a page to display a list of your eve
35
  * past - Show Outdated Events. [ecs-list-events cat='festival' past='yes']
36
  * key - Order with Start Date [ecs-list-events cat='festival' key='start date']
37
 
38
- = Pro Version Options: =
 
39
  * design - Shows improved design by default, or set to 'standard' for the regular one and 'compact' for a more compact listing
40
  * days - Specify how many days in the future, for example [ecs-list-events days="1"] for one day or [ecs-list-events days="7"] for one week
41
  * tag - Filter by one or more tags. Use commas when you want to filter by multiple tags.
 
 
 
 
 
 
 
42
  * hiderecurring - To only show the first instance of a recurring event, set to 'true'
43
 
44
  [View Details and Get the Pro Version](https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=wordpress.org&utm_medium=link&utm_campaign=tecs-readme&utm_content=description)
@@ -109,6 +118,9 @@ include echo do_shortcode("[ecs-list-events]"); in the template where you want t
109
 
110
  == Upgrade Notice ==
111
 
 
 
 
112
  = 1.4 =
113
  * Checks for whether The Events Calendar is installed
114
  * Additional filters
@@ -150,6 +162,9 @@ Fix missing ul
150
 
151
  == Changelog ==
152
 
 
 
 
153
  = 1.4 =
154
  * Checks for whether The Events Calendar is installed
155
  * Additional filters
2
  Contributors: brianhogg, dandelionweb, ankitpokhrel, sujin2f
3
  Tags: event, events, calendar, shortcode, modern tribe
4
  Requires at least: 4.0
5
+ Tested up to: 4.7.2
6
+ Stable tag: 1.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
24
  * order - Order of the events to be shown. Value can be 'ASC' or 'DESC'. Default is 'ASC'. Order is based on event date. [ecs-list-events order='DESC']
25
  * date - To show or hide date. Value can be 'true' or 'false'. Default is true. [ecs-list-events eventdetails='false']
26
  * venue - To show or hide the venue. Value can be 'true' or 'false'. Default is false. [ecs-list-events venue='true']
27
+ * excerpt - To show or hide the excerpt and set excerpt length. Default is false.
28
+ * [ecs-list-events excerpt='true'] //displays excerpt with length 100
29
+ * [ecs-list-events excerpt='300'] //displays excerpt with length 300
30
  * thumb - To show or hide thumbnail image. Default is false. [ecs-list-events thumb='true'] //displays post thumbnail in default thumbnail dimension from media settings.
31
  * You can use 2 other attributes: thumbwidth and thumbheight to customize the thumbnail size [ecs-list-events thumb='true' thumbwidth='150' thumbheight='150']
32
  * message - Message to show when there are no events. Defaults to 'There are no upcoming events at this time.'
36
  * past - Show Outdated Events. [ecs-list-events cat='festival' past='yes']
37
  * key - Order with Start Date [ecs-list-events cat='festival' key='start date']
38
 
39
+ Additional options in the [pro version](https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=wordpress.org&utm_medium=link&utm_campaign=tecs-readme-top&utm_content=description):
40
+
41
  * design - Shows improved design by default, or set to 'standard' for the regular one and 'compact' for a more compact listing
42
  * days - Specify how many days in the future, for example [ecs-list-events days="1"] for one day or [ecs-list-events days="7"] for one week
43
  * tag - Filter by one or more tags. Use commas when you want to filter by multiple tags.
44
+ * id - Show a single event, useful for displaying details of the event on a blog post or page
45
+ * description - Use the full description instead of the excerpt of an event in the listing
46
+ * raw_description - Avoid filtering any HTML (spacing, links, bullet points, etc) in the description
47
+ * raw_excerpt - Avoid filtering any HTML (spacing, links, etc) in the excerpt
48
+ * year - Show only events for a specific year
49
+ * offset - Skip a certain number of events from the beginning, useful for using multiple shortcodes on the same page (with ads in between) or splitting into columns
50
+ * custom design - Create one or more of your own templates for use with the shortcode
51
  * hiderecurring - To only show the first instance of a recurring event, set to 'true'
52
 
53
  [View Details and Get the Pro Version](https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=wordpress.org&utm_medium=link&utm_campaign=tecs-readme&utm_content=description)
118
 
119
  == Upgrade Notice ==
120
 
121
+ = 1.4.1 =
122
+ * Additional filters for formatting a single event
123
+
124
  = 1.4 =
125
  * Checks for whether The Events Calendar is installed
126
  * Additional filters
162
 
163
  == Changelog ==
164
 
165
+ = 1.4.1 =
166
+ * Additional filters for formatting a single event
167
+
168
  = 1.4 =
169
  * Checks for whether The Events Calendar is installed
170
  * Additional filters
static/shortcode-default-design-2.png ADDED
Binary file
static/the-events-calendar-shortcode-pro-design.png DELETED
Binary file
templates/admin-page.php CHANGED
@@ -90,8 +90,8 @@
90
  </ul>
91
 
92
  <p><em>Want a better looking design without adding any CSS? Check out <a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design&utm_content=description">The Events Calendar Shortcode PRO</a></em></p>
93
- <p><a 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 style="width: 200px;" src="<?php echo plugins_url( '/static/the-events-calendar-shortcode-pro-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br>Pro version default design</a></p>
94
- <p><a 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 style="width: 200px;" src="<?php echo plugins_url( '/static/event-calendar-shortcode-compact-design.png', TECS_CORE_PLUGIN_FILE ) ?>"><br>Pro version compact design</a></p>
95
 
96
  <?php endif; ?>
97
  </td>
90
  </ul>
91
 
92
  <p><em>Want a better looking design without adding any CSS? Check out <a target="_blank" href="https://eventcalendarnewsletter.com/the-events-calendar-shortcode?utm_source=plugin&utm_medium=link&utm_campaign=tecs-help-design&utm_content=description">The Events Calendar Shortcode PRO</a></em></p>
93
+ <p><a 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>Pro version default design</a></p>
94
+ <p><a 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>Pro version compact design</a></p>
95
 
96
  <?php endif; ?>
97
  </td>
the-events-calendar-shortcode.php CHANGED
@@ -3,7 +3,7 @@
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.4
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
@@ -239,14 +239,14 @@ class Events_Calendar_Shortcode
239
 
240
  foreach( $posts as $post ) {
241
  setup_postdata( $post );
 
 
242
 
243
- $output .= apply_filters( 'ecs_event_start_tag', '<li class="ecs-event">', $atts, $post );
244
-
245
- // Put Values into $output
246
  foreach ( apply_filters( 'ecs_event_contentorder', $atts['contentorder'], $atts, $post ) as $contentorder ) {
247
  switch ( trim( $contentorder ) ) {
248
  case 'title':
249
- $output .= apply_filters( 'ecs_event_title_tag_start', '<h4 class="entry-title summary">', $atts, $post ) .
250
  '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . apply_filters( 'ecs_event_list_title', get_the_title(), $atts, $post ) . '</a>' .
251
  apply_filters( 'ecs_event_title_tag_end', '</h4>', $atts, $post );
252
  break;
@@ -256,12 +256,12 @@ class Events_Calendar_Shortcode
256
  $thumbWidth = is_numeric($atts['thumbwidth']) ? $atts['thumbwidth'] : '';
257
  $thumbHeight = is_numeric($atts['thumbheight']) ? $atts['thumbheight'] : '';
258
  if( !empty( $thumbWidth ) && !empty( $thumbHeight ) ) {
259
- $output .= apply_filters( 'ecs_event_thumbnail', get_the_post_thumbnail( get_the_ID(), apply_filters( 'ecs_event_thumbnail_size', array( $thumbWidth, $thumbHeight ), $atts, $post ) ), $atts, $post );
260
  } else {
261
  if ( $thumb = get_the_post_thumbnail( get_the_ID(), apply_filters( 'ecs_event_thumbnail_size', 'medium', $atts, $post ) ) ) {
262
- $output .= apply_filters( 'ecs_event_thumbnail_link_start', '<a href="' . tribe_get_event_link() . '">', $atts, $post );
263
- $output .= apply_filters( 'ecs_event_thumbnail', $thumb, $atts, $post );
264
- $output .= apply_filters( 'ecs_event_thumbnail_link_end', '</a>', $atts, $post );
265
  }
266
  }
267
  }
@@ -270,15 +270,15 @@ class Events_Calendar_Shortcode
270
  case 'excerpt':
271
  if ( self::isValid( $atts['excerpt'] ) ) {
272
  $excerptLength = is_numeric($atts['excerpt']) ? $atts['excerpt'] : 100;
273
- $output .= apply_filters( 'ecs_event_excerpt_tag_start', '<p class="ecs-excerpt">', $atts, $post ) .
274
- apply_filters( 'ecs_event_excerpt', self::get_excerpt( $excerptLength ), $atts, $post ) .
275
  apply_filters( 'ecs_event_excerpt_tag_end', '</p>', $atts, $post );
276
  }
277
  break;
278
 
279
  case 'date':
280
  if ( self::isValid( $atts['eventdetails'] ) ) {
281
- $output .= apply_filters( 'ecs_event_date_tag_start', '<span class="duration time">', $atts, $post ) .
282
  apply_filters( 'ecs_event_list_details', tribe_events_event_schedule_details(), $atts, $post ) .
283
  apply_filters( 'ecs_event_date_tag_end', '</span>', $atts, $post );
284
  }
@@ -286,7 +286,7 @@ class Events_Calendar_Shortcode
286
 
287
  case 'venue':
288
  if ( self::isValid( $atts['venue'] ) ) {
289
- $output .= apply_filters( 'ecs_event_venue_tag_start', '<span class="duration venue">', $atts, $post ) .
290
  apply_filters( 'ecs_event_venue_at_tag_start', '<em> ', $atts, $post ) .
291
  apply_filters( 'ecs_event_venue_at_text', __( 'at', 'the-events-calendar-shortcode' ), $atts, $post ) .
292
  apply_filters( 'ecs_event_venue_at_tag_end', ' </em>', $atts, $post ) .
@@ -296,14 +296,15 @@ class Events_Calendar_Shortcode
296
  break;
297
  case 'date_thumb':
298
  if ( self::isValid( $atts['eventdetails'] ) ) {
299
- $output .= apply_filters( 'ecs_event_date_thumb', '<div class="date_thumb"><div class="month">' . tribe_get_start_date( null, false, 'M' ) . '</div><div class="day">' . tribe_get_start_date( null, false, 'j' ) . '</div></div>', $atts, $post );
300
  }
301
  break;
302
  default:
303
- $output .= apply_filters( 'ecs_event_list_output_custom', '', trim( $contentorder ), $atts, $post );
304
  }
305
  }
306
- $output .= apply_filters( 'ecs_event_end_tag', '</li>', $atts, $post );
 
307
  }
308
  $output .= apply_filters( 'ecs_end_tag', '</ul>', $atts );
309
 
@@ -343,7 +344,7 @@ class Events_Calendar_Shortcode
343
  *
344
  * @return string
345
  */
346
- private function get_excerpt( $limit, $source = null )
347
  {
348
  $excerpt = get_the_excerpt();
349
  if( $source == "content" ) {
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.4.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
239
 
240
  foreach( $posts as $post ) {
241
  setup_postdata( $post );
242
+ $event_output = '';
243
+ $event_output .= apply_filters( 'ecs_event_start_tag', '<li class="ecs-event">', $atts, $post );
244
 
245
+ // Put Values into $event_output
 
 
246
  foreach ( apply_filters( 'ecs_event_contentorder', $atts['contentorder'], $atts, $post ) as $contentorder ) {
247
  switch ( trim( $contentorder ) ) {
248
  case 'title':
249
+ $event_output .= apply_filters( 'ecs_event_title_tag_start', '<h4 class="entry-title summary">', $atts, $post ) .
250
  '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . apply_filters( 'ecs_event_list_title', get_the_title(), $atts, $post ) . '</a>' .
251
  apply_filters( 'ecs_event_title_tag_end', '</h4>', $atts, $post );
252
  break;
256
  $thumbWidth = is_numeric($atts['thumbwidth']) ? $atts['thumbwidth'] : '';
257
  $thumbHeight = is_numeric($atts['thumbheight']) ? $atts['thumbheight'] : '';
258
  if( !empty( $thumbWidth ) && !empty( $thumbHeight ) ) {
259
+ $event_output .= apply_filters( 'ecs_event_thumbnail', get_the_post_thumbnail( get_the_ID(), apply_filters( 'ecs_event_thumbnail_size', array( $thumbWidth, $thumbHeight ), $atts, $post ) ), $atts, $post );
260
  } else {
261
  if ( $thumb = get_the_post_thumbnail( get_the_ID(), apply_filters( 'ecs_event_thumbnail_size', 'medium', $atts, $post ) ) ) {
262
+ $event_output .= apply_filters( 'ecs_event_thumbnail_link_start', '<a href="' . tribe_get_event_link() . '">', $atts, $post );
263
+ $event_output .= apply_filters( 'ecs_event_thumbnail', $thumb, $atts, $post );
264
+ $event_output .= apply_filters( 'ecs_event_thumbnail_link_end', '</a>', $atts, $post );
265
  }
266
  }
267
  }
270
  case 'excerpt':
271
  if ( self::isValid( $atts['excerpt'] ) ) {
272
  $excerptLength = is_numeric($atts['excerpt']) ? $atts['excerpt'] : 100;
273
+ $event_output .= apply_filters( 'ecs_event_excerpt_tag_start', '<p class="ecs-excerpt">', $atts, $post ) .
274
+ apply_filters( 'ecs_event_excerpt', self::get_excerpt( $excerptLength ), $atts, $post, $excerptLength ) .
275
  apply_filters( 'ecs_event_excerpt_tag_end', '</p>', $atts, $post );
276
  }
277
  break;
278
 
279
  case 'date':
280
  if ( self::isValid( $atts['eventdetails'] ) ) {
281
+ $event_output .= apply_filters( 'ecs_event_date_tag_start', '<span class="duration time">', $atts, $post ) .
282
  apply_filters( 'ecs_event_list_details', tribe_events_event_schedule_details(), $atts, $post ) .
283
  apply_filters( 'ecs_event_date_tag_end', '</span>', $atts, $post );
284
  }
286
 
287
  case 'venue':
288
  if ( self::isValid( $atts['venue'] ) ) {
289
+ $event_output .= apply_filters( 'ecs_event_venue_tag_start', '<span class="duration venue">', $atts, $post ) .
290
  apply_filters( 'ecs_event_venue_at_tag_start', '<em> ', $atts, $post ) .
291
  apply_filters( 'ecs_event_venue_at_text', __( 'at', 'the-events-calendar-shortcode' ), $atts, $post ) .
292
  apply_filters( 'ecs_event_venue_at_tag_end', ' </em>', $atts, $post ) .
296
  break;
297
  case 'date_thumb':
298
  if ( self::isValid( $atts['eventdetails'] ) ) {
299
+ $event_output .= apply_filters( 'ecs_event_date_thumb', '<div class="date_thumb"><div class="month">' . tribe_get_start_date( null, false, 'M' ) . '</div><div class="day">' . tribe_get_start_date( null, false, 'j' ) . '</div></div>', $atts, $post );
300
  }
301
  break;
302
  default:
303
+ $event_output .= apply_filters( 'ecs_event_list_output_custom_' . strtolower( trim( $contentorder ) ), '', $atts, $post );
304
  }
305
  }
306
+ $event_output .= apply_filters( 'ecs_event_end_tag', '</li>', $atts, $post );
307
+ $output .= apply_filters( 'ecs_single_event_output', $event_output, $atts, $post );
308
  }
309
  $output .= apply_filters( 'ecs_end_tag', '</ul>', $atts );
310
 
344
  *
345
  * @return string
346
  */
347
+ public static function get_excerpt( $limit, $source = null )
348
  {
349
  $excerpt = get_the_excerpt();
350
  if( $source == "content" ) {