Below, you’ll find a detailed guide on how to add the Event Organiser Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Event Organiser Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Event Organiser Plugin and the shortcodes it provides:
"Event Organiser is a powerful WordPress plugin designed to manage and schedule events efficiently. It offers a user-friendly interface, making event planning quick and hassle-free."
- [eo_calendar]
- [eo_fullcalendar]
- [eo_venue_map]
- [eo_events]
- [eo_subscribe]
Event Organiser [eo_calendar] Shortcode
The ‘eo_calendar’ shortcode from Event Organiser plugin generates a dynamic event calendar. It accepts parameters like ‘showpastevents’, ‘show-long’, and ‘link-to-single’ to customize the output.
Shortcode: [eo_calendar]
Parameters
Here is a list of all possible eo_calendar shortcode parameters and attributes:
event_category
– Filters the calendar to only show events from a specific category.event_tag
– Filters the calendar to only show events with a specific tag.event_venue
– Filters the calendar to only show events at a specific venue.show_long
– If set to 1, events will display their full duration on the calendar.link_to_single
– If set to 1, clicking an event will take you to its single event page.showpastevents
– If set to 1, the calendar will also display past events.
Examples and Usage
Basic example – Displaying a calendar with default settings
[eo_calendar /]
Advanced examples
Displaying a calendar with specific events category and a link to single event
[eo_calendar event_category="meetings" link_to_single=1 /]
Showing a calendar with events from a specific venue and displaying past events
[eo_calendar event_venue="conference-hall" showpastevents=1 /]
Displaying a calendar with long event details and events from a specific tag
[eo_calendar event_tag="workshop" show_long=1 /]
These examples utilize different attributes of the ‘eo_calendar’ shortcode to customize the output of the calendar. You can mix and match these attributes to suit your specific needs.
PHP Function Code
In case you have difficulties debugging what causing issues with [eo_calendar]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('eo_calendar', array(__CLASS__, 'handle_calendar_shortcode'));
Shortcode PHP function:
function handle_calendar_shortcode($atts = array()) {
$atts = (array) $atts;
/* Shortcodes don't accept hyphens, so convert taxonomy names */
$taxs = array('category','tag','venue');
foreach ($taxs as $tax){
if(isset($atts['event_'.$tax])){
$atts['event-'.$tax]= $atts['event_'.$tax];
unset($atts['event_'.$tax]);
}
}
if( isset( $atts['show_long'] ) ){
$atts['show-long'] = $atts['show_long'];
unset( $atts['show_long'] );
}
if( isset( $atts['link_to_single'] ) ){
$atts['link-to-single'] = $atts['link_to_single'];
unset( $atts['link_to_single'] );
}
/* Parse defaults */
$atts = wp_parse_args($atts,array(
'showpastevents' => 1,
'show-long' => 0,
'link-to-single' => 0,
));
self::$add_script = true;
$id = count(self::$widget_calendars);
$cal_id = 'eo_shortcode_calendar_'.$id;
self::$widget_calendars[$cal_id] = $atts;
$tz = eo_get_blog_timezone();
$date = isset($_GET['eo_month']) ? $_GET['eo_month'].'-01' : 'now';
$month = new DateTime($date,$tz);
$month = date_create($month->format('Y-m-1'),$tz);
$html = '<div class="widget_calendar eo-calendar eo-calendar-shortcode eo_widget_calendar" id="'.$cal_id.'">';
$html .= '<div id="'.$cal_id.'_content" class="eo-widget-cal-wrap" data-eo-widget-cal-id="'.$cal_id.'">';
$html .= EO_Calendar_Widget::generate_output( $month, $atts );
$html .='</div>';
$html .= '</div>';
return $html;
}
Code file location:
event-organiser/event-organiser/classes/class-eventorganiser-shortcodes.php
Event Organiser [eo_fullcalendar] Shortcode
The ‘eo_fullcalendar’ shortcode from the Event Organiser plugin generates a fully customizable calendar for your events. It accepts various attributes to modify its behavior. The shortcode handles boolean attributes such as ‘tooltip’, ‘weekends’, ‘alldayslot’, etc. It supports backward compatibility and allows you to choose the position of the key. It also allows customization of the ‘event_venue’ and ‘event_category’ by accepting ‘venue’ and ‘category’ attributes. The shortcode also supports date formatting attributes like ‘timeformat’, ‘axisformat’, etc. Lastly, it can handle all taxonomies associated with the ‘event’ post type.
Shortcode: [eo_fullcalendar]
Parameters
Here is a list of all possible eo_fullcalendar shortcode parameters and attributes:
tooltip
– enables or disables tooltipsweekends
– shows or hides weekend daysalldayslot
– shows or hides the all-day event slotusers_events
– shows only events from the current logged in usertheme
– activates or deactivates the themeisrtl
– sets the text direction from right to leftresponsive
– makes the calendar responsive to different screen sizescompact
– enables or disables the compact viewkey
– positions the navigation buttons at the bottom or topvenue
– filters events by venuecategory
– filters events by categorytimeformat
– sets the format for displaying timeaxisformat
– sets the format for displaying the axistitleformatday
– sets the format for displaying day titlestitleformatweek
– sets the format for displaying week titlescolumnformatmonth
– sets the format for monthly column headerscolumnformatweek
– sets the format for weekly column headersshowdays
– sets which days to show on the calendar
Examples and Usage
Basic example – Display an event full calendar with default settings
[eo_fullcalendar /]
Advanced examples
Display an event full calendar with tooltip enabled and weekends disabled
[eo_fullcalendar tooltip="true" weekends="false" /]
Display an event full calendar for a specific event category and venue
[eo_fullcalendar event_category="music" event_venue="stadium" /]
Display an event full calendar with a compact layout and show only specific days of the week
[eo_fullcalendar compact="true" showdays="1,3,5" /]
Display an event full calendar with a custom time format and column format for a day
[eo_fullcalendar timeformat="H:i" columnformatday="dddd" /]
Display an event full calendar with a responsive layout and RTL support
[eo_fullcalendar responsive="true" isrtl="true" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [eo_fullcalendar]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('eo_fullcalendar', array( __CLASS__, 'handle_fullcalendar_shortcode'));
Shortcode PHP function:
function handle_fullcalendar_shortcode( $atts = array() ) {
global $wp_locale;
/* Handle Boolean attributes - this will be passed as strings, we want them as boolean */
$bool_atts = array(
'tooltip' => 'true', 'weekends' => 'true', 'alldayslot' => 'true', 'users_events' => 'false',
'theme' => 'false', 'isrtl' => $wp_locale->is_rtl() ? 'true' : 'false', 'responsive' => 'true',
'compact' => false,
);
$atts = wp_parse_args( $atts, $bool_atts );
foreach( $bool_atts as $att => $value ){
$atts[$att] = ( strtolower( $atts[$att] ) == 'true' ? true : false );
}
//Backwards compatability, key used to be true/false. Now can be bottom/top
if( isset( $atts['key'] ) ){
if( 'true' == strtolower( $atts['key'] ) ){
$atts['key'] = 'bottom';
}elseif( !in_array( strtolower( $atts['key'] ), array( 'bottom', 'top' ) ) ){
$atts['key'] = false;
}
}
if( isset($atts['venue']) && !isset( $atts['event_venue'] ) ){
$atts['event_venue'] = $atts['venue'];
unset( $atts['venue'] );
}
if( isset($atts['category']) && !isset( $atts['event_category'] ) ){
$atts['event_category'] = $atts['category'];
unset( $atts['category'] );
}
$date_attributes = array(
'timeformat', 'axisformat', 'titleformatday', 'titleformatweek', 'titleformatmonth',
'columnformatmonth', 'columnformatweek', 'columnformatday',
);
foreach( $date_attributes as $attribute ){
if( isset( $atts[$attribute] ) ){
$atts[$attribute] = self::_cleanup_format( $atts[$attribute] );
}
}
$taxonomies = get_object_taxonomies( 'event' );
foreach( $taxonomies as $tax ){
//Shortcode attributes can't contain hyphens
$shortcode_attr = str_replace( '-', '_', $tax );
if( isset( $atts[$shortcode_attr] ) ){
$atts[$tax] = $atts[$shortcode_attr];
unset( $atts[$shortcode_attr] );
}
}
if( isset( $atts['showdays'] ) ){
$atts['showdays'] = explode( ',', $atts['showdays'] );
}
return eo_get_event_fullcalendar( $atts );
}
Code file location:
event-organiser/event-organiser/classes/class-eventorganiser-shortcodes.php
Event Organiser [eo_venue_map] Shortcode
The Event Organiser plugin shortcode ‘eo_venue_map’ generates a venue map for events. It accepts various parameters like zoom level, controls, and map type. This shortcode dynamically fetches the venue from the event details or the queried term. It also allows customization of map features such as zoom control, scroll wheel, and map type. The map’s dimensions can be adjusted as well. Shortcode: [eo_venue_map]
Shortcode: [eo_venue_map]
Parameters
Here is a list of all possible eo_venue_map shortcode parameters and attributes:
event_venue
– specifies the venue of the eventzoom
– sets the initial zoom level of the mapzoomcontrol
– enables or disables the zoom control on the mapminzoom
– sets the minimum zoom level of the mapmaxzoom
– sets the maximum zoom level of the mapscrollwheel
– allows or disallows map zooming with mouse scroll wheelrotatecontrol
– enables or disables rotation control on the mappancontrol
– enables or disables pan control on the mapoverviewmapcontrol
– shows or hides the overview map controlstreetviewcontrol
– shows or hides the street view controlmaptypecontrol
– shows or hides the map type controldraggable
– allows or disallows dragging the mapmaptypeid
– sets the initial map typewidth
– sets the width of the mapheight
– sets the height of the mapclass
– adds a class to the map container for stylingtooltip
– enables or disables tooltips on the map
Examples and Usage
Basic example – Displays a map of the venue associated with the current event or post.
[eo_venue_map /]
Advanced examples
Displays a map of a specific venue by referencing the venue slug. The map will show the venue location with a default zoom level of 15.
[eo_venue_map venue="my-venue-slug" /]
Displays a map with custom zoom level and disables the zoom control. The map will show the location of the venue associated with the current event or post, but users will not be able to zoom in or out.
[eo_venue_map zoom="10" zoomcontrol="false" /]
Displays a map with custom width and height. The map will show the location of the venue associated with the current event or post, with the specified width and height.
[eo_venue_map width="500px" height="300px" /]
Displays a map with a tooltip. The map will show the location of the venue associated with the current event or post, and a tooltip will appear when the user hovers over the map.
[eo_venue_map tooltip="true" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [eo_venue_map]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('eo_venue_map', array(__CLASS__, 'handle_venuemap_shortcode'));
Shortcode PHP function:
function handle_venuemap_shortcode($atts = array()) {
global $post;
$atts = (array) $atts;
if( !empty( $atts['event_venue'] ) ){
$atts['venue'] = $atts['event_venue'];
}
//If venue is not set get from the venue being quiered or the post being viewed
if( empty($atts['venue']) ){
if( eo_is_venue() ){
$atts['venue'] = esc_attr( get_query_var( 'term' ) );
}else{
$atts['venue'] = eo_get_venue_slug( get_the_ID() );
}
}
$venue_slugs = explode( ',', $atts['venue'] );
$args = shortcode_atts( array(
'zoom' => 15, 'zoomcontrol' => 'true', 'minzoom' => 0, 'maxzoom' => null,
'scrollwheel' => 'true', 'rotatecontrol' => 'true', 'pancontrol' => 'true',
'overviewmapcontrol' => 'true', 'streetviewcontrol' => 'true',
'maptypecontrol' => 'true', 'draggable' => 'true', 'maptypeid' => 'ROADMAP',
'width' => '100%','height' => '200px','class' => '', 'tooltip' => 'false',
), $atts );
//Cast options as boolean:
$bool_options = array(
'tooltip', 'scrollwheel', 'zoomcontrol', 'rotatecontrol', 'pancontrol',
'overviewmapcontrol', 'streetviewcontrol', 'draggable', 'maptypecontrol',
);
foreach( $bool_options as $option ){
$args[$option] = ( $args[$option] == 'false' ? false : true );
}
return eo_get_venue_map( $venue_slugs, $args );
}
Code file location:
event-organiser/event-organiser/classes/class-eventorganiser-shortcodes.php
Event Organiser [eo_events] Shortcode
The Event Organiser plugin shortcode, ‘eo_events’, dynamically lists events. It checks for event categories, tags, venues, and user-specific events. If a venue is specified, it fetches the venue slug. The shortcode also supports displaying a custom message when no events are found.
Shortcode: [eo_events]
Parameters
Here is a list of all possible eo_events shortcode parameters and attributes:
event_category
– Defines the category of the event.event_tag
– Specifies the tag associated with the event.event_venue
– Indicates the venue where the event will occur.venue
– Used to set the venue, if set to ‘%this%’, it fetches the current venue.users_events
– If set to ‘true’, it fetches events related to the current user.no_events
– Message to display when no events are found.
Examples and Usage
Basic example – Display a list of events using the ‘eo_events’ shortcode without any additional parameters.
[eo_events /]
Advanced examples
Display a list of events from a specific category. In this example, the ‘event_category’ parameter is used to specify the category of events to display. The category should be specified by its slug.
[eo_events event_category='music-festival' /]
Display a list of events that are taking place at a specific venue. In this example, the ‘event-venue’ parameter is used to specify the venue of the events to display. The venue should be specified by its slug.
[eo_events event-venue='central-park' /]
Display a list of events that are tagged with a specific tag. In this example, the ‘event-tag’ parameter is used to specify the tag of events to display. The tag should be specified by its slug.
[eo_events event-tag='summer' /]
Display a list of events that the current user has booked. In this example, the ‘users_events’ parameter is set to ‘true’ to display the events that the current user has booked.
[eo_events users_events='true' /]
Display a list of events and specify a custom message to display if there are no events. In this example, the ‘no_events’ parameter is used to specify the custom message.
[eo_events no_events='No upcoming events at the moment. Please check back later.' /]
PHP Function Code
In case you have difficulties debugging what causing issues with [eo_events]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('eo_events', array(__CLASS__, 'handle_eventlist_shortcode'));
Shortcode PHP function:
function handle_eventlist_shortcode($atts=array(),$content=null) {
$atts = (array) $atts;
$taxs = array('category','tag','venue');
foreach ($taxs as $tax){
if(isset($atts['event_'.$tax])){
$atts['event-'.$tax]= $atts['event_'.$tax];
unset($atts['event_'.$tax]);
}
}
if((isset($atts['venue']) &&$atts['venue']=='%this%') ||( isset($atts['event-venue']) && $atts['event-venue']=='%this%' )){
if( eo_get_venue_slug() ){
$atts['event-venue']= eo_get_venue_slug();
}else{
unset($atts['venue']);
unset($atts['event-venue']);
}
}
if( isset( $atts['users_events'] ) && strtolower( $atts['users_events'] ) == 'true' ){
$atts['bookee_id'] = get_current_user_id();
}
$args = array(
'class'=>'eo-events eo-events-shortcode',
'template'=>$content,
'no_events'=> isset( $atts['no_events'] ) ? $atts['no_events'] : '',
'type'=>'shortcode',
);
return eventorganiser_list_events( $atts,$args, 0);
}
Code file location:
event-organiser/event-organiser/classes/class-eventorganiser-shortcodes.php
Event Organiser [eo_subscribe] Shortcode
The ‘eo_subscribe’ shortcode from Event Organiser plugin allows users to subscribe to event feeds. It supports Google, webcal, and ical formats. This shortcode can be customized with various attributes like title, type, class, id, style, category, and venue. The ‘category’ and ‘venue’ attributes fetch feeds for specific categories or venues. The ‘type’ attribute adjusts the URL format based on the chosen subscription type. The final output is a clickable link, leading to the chosen event feed.
Shortcode: [eo_subscribe]
Parameters
Here is a list of all possible eo_subscribe shortcode parameters and attributes:
title
– Defines the text displayed on the calendar subscribe button.type
– Specifies the calendar type (google, webcal, or ical).class
– Adds a custom CSS class to the subscribe button.id
– Assigns a unique identifier to the subscribe button.style
– Allows inline CSS styling for the subscribe button.category
– Filters events by specific category in the feed.venue
– Filters events by specific venue in the feed.
Examples and Usage
Basic example – Display a link for subscribing to the calendar with default settings.
[eo_subscribe /]
Advanced examples
Display a link for subscribing to the calendar with a specific title and style.
[eo_subscribe title="My Custom Title" style="color:blue;"]
Display a link for subscribing to a specific event category or venue.
[eo_subscribe category="festival"]
Conclusion
Now that you’ve learned how to embed the Event Organiser Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply