WP Manifestindependent plugin directory
manifest / events / display-eventbrite-custom-layout-example

Display Eventbrite Custom Layout Example

Worked example of a custom layout plugin for Display Eventbrite Events (WordPress)

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/alanef/display-eventbrite-custom-layout-example/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A small, working WordPress plugin that adds a custom layout to Display Eventbrite Events. Copy it, rename it and change it to build your own layout.

Custom layouts need a paid plan of Display Eventbrite Events.

Try it

  1. Download this repository as a zip (Code → Download ZIP) and install it from Plugins → Add New → Upload Plugin, or clone it into wp-content/plugins/.

  2. Activate it alongside Display Eventbrite Events.

  3. Add the shortcode to a page:

    [wfea layout="example"]

All the usual shortcode options still apply, for example [wfea layout="example" limit="5" thumb="false" newtab="true"].

How it works

display-eventbrite-custom-layout-example.php   registers the template folders
templates/
  layout_example.php                           entry point for layout="example"
  loops/
    loop_example.php                           markup for one event
  parts/
    example_when_where.php                     a template part of your own
css/
  example.css                                  loaded only on pages using the layout
  • The plugin file calls \WidgetForEventbriteAPI\Includes\Utilities::get_instance()->register_template_dirs( plugin_dir_path( __FILE__ ) ) on plugins_loaded. Display Eventbrite Events then looks in this plugin's templates/, templates/loops/ and templates/parts/ before its own.
  • layout_example.php sets the layout's CSS class prefix and name, then loads the main plugin's shared common template. common handles search, pagination, the "no events" message and the details popup, and calls loops/loop_example.php once per event.
  • loop_example.php builds each event. It reuses the main plugin's parts (thumb, header, content, booknow), which already follow the shortcode options, and adds one part of its own.
  • parts/example_when_where.php shows how to read the event directly through $data->utilities (get_event(), get_event_title(), get_event_start(), get_event_eb_url(), get_element()), escaping everything on output.

Make it your own

  1. Rename the folder and the main plugin file, and change the plugin header.
  2. Rename layout_example.php and loop_example.php to layout_{yourname}.php and loop_{yourname}.php, and set layout_name to {yourname} in the layout file.
  3. Change layout_class and the CSS to match.
  4. Use it with [wfea layout="{yourname}"].

A file in templates/parts/ with the same name as one in Display Eventbrite Events replaces that part for every layout, for example templates/parts/booknow.php.

To see what is available, var_dump( $data->utilities->get_event() ) inside a loop or part prints the full event, and the developer documentation covers the template functions.

Licence

GPL-2.0-or-later. See LICENSE.