Events Search For The Events Calendar Shortcode

Below, you’ll find a detailed guide on how to add the Events Search For The Events Calendar Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Events Search For The Events Calendar Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Events Search For The Events Calendar Plugin and the shortcodes it provides:

Plugin Icon
Events Search For The Events Calendar

"Events Search For The Events Calendar is a WordPress plugin that enhances your website's functionality by allowing users to effortlessly search and filter through your event listings."

★★★★☆ (23) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [events-calendar-search]

Events Search For The Events Calendar [events-calendar-search] Shortcode

The Events Calendar Search Addon shortcode enables the customization of the events search feature. It allows setting a placeholder, the number of events to display, disabling past events, and choosing the layout and content type.

Shortcode: [events-calendar-search]

Parameters

Here is a list of all possible events-calendar-search shortcode parameters and attributes:

  • placeholder – Text displayed in search box before user input
  • show-events – Number of events to display in search results
  • disable-past-events – If set to ‘true’, past events won’t be shown
  • content-type – Determines the type of content to be displayed
  • layout – Defines the layout style of the event display

Examples and Usage

Basic example – A simple usage of the events-calendar-search shortcode with default settings. The placeholder text will be ‘Search Events’, it will show 10 events, past events will not be disabled, the content type will be advanced, and the layout will be medium.

[events-calendar-search /]

Advanced examples:

Using the shortcode to customize the placeholder text, show 15 events, disable past events, set the content type to basic, and choose a large layout.

[events-calendar-search placeholder="Find an Event" show-events="15" disable-past-events="true" content-type="basic" layout="large" /]

Using the shortcode to display a specific number of upcoming events without the option to search past events. The placeholder text is set to ‘Search Future Events’ and the layout is set to small.

[events-calendar-search placeholder="Search Future Events" show-events="5" disable-past-events="true" layout="small" /]

Using the shortcode to display a large number of events with the placeholder text set to ‘Search All Events’. Past events are not disabled and the layout is set to large.

[events-calendar-search placeholder="Search All Events" show-events="50" disable-past-events="false" layout="large" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [events-calendar-search] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'events-calendar-search', array( $this, 'ecsa_shortcode' ) );

Shortcode PHP function:

                    function ecsa_shortcode( $attributes, $content = null ) {
			$attributes = shortcode_atts(
				array(
					'placeholder'         => '',
					'show-events'         => '',
					'disable-past-events' => '',
					'content-type'           => '',
					'layout'              => '',
				),
				$attributes,
				'ecsa'
			);

			$placeholder   = ( ( $attributes['placeholder'] != '' ) ? $attributes['placeholder'] : __( 'Search Events', 'ecsa' ) );
			$show_events   = ( ( $attributes['show-events'] != '' ) ? $attributes['show-events'] : '10' );
			$disable_past  = ( ( $attributes['disable-past-events'] != '' ) ? $attributes['disable-past-events'] : 'false' );
			$layout        = ( ( $attributes['layout'] != '' ) ? $attributes['layout'] : 'medium' );
			$content_type = ( ( $attributes['content-type'] != '' ) ? $attributes['content-type'] : 'advance' );
		
			$generate_html = ecsa_generate_html( $placeholder, $show_events, $disable_past, $content_type, $layout );
		
			return $generate_html;

		}
                    

Code file location:

events-search-addon-for-the-events-calendar/events-search-addon-for-the-events-calendar/events-calendar-search-addon.php

Conclusion

Now that you’ve learned how to embed the Events Search For The Events Calendar Plugin shortcode, 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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *