If you're going to include the Modern Events Calendar in your theme, then please note the following as a guide.

Including the MEC

To include the Modern Event Calendar plugin you can simply use TGMPA plugin. It works completely fine with this plugin.

For better User Experience, MEC imports some events and shortcodes upon activation. If you want to disable this feature for any reason, you can use the two following filters:

Disabling Dummy Events

add_filter('mec_activation_import_events', '__return_false');

Disabling Dummy Shortcodes (Not Recommended if you're not going to add your own shortcodes!)

add_filter('mec_activation_import_shortcodes', '__return_false');

Importing Demo Data

You can insert your own dummy data into MEC simply. There are three main concepts for data importing:

1.Importing Events

MEC events are created by WP post type + a record in [wp_prefix]_mec_events table so you should import both otherwise the event is incomplete and it won't show on the front-end of the website. For importing the post types, you can simply use the solution that you use for other post types such as post, page etc.

For the mec_events records, we suggest to create a SQL export file from your mec_events table on your demo website and then write a simple PHP code to run the .sql file queries into the client website. You can use codes like the following:

$query_file = '/path/to/mec_events.sql';
$queries = file_get_contents($query_file);
$sqls = explode(';', $queries);
// WordPress DB
global $wpdb;
foreach($sqls as $sql)
    $sql = trim($sql, '; ');
    if(trim($sql) == '') continue;
    $sql .= ';';

Note: You should take care about WP table prefix. We suggest changing the prefix in the sql file to something unique. For example change the INSERT INTO wp_mec_events to INSERT INTO #__mec_events in the SQL file and replace #__ with $wpdb->prefix before calling the query.

As another approach you can assign the queries to a PHP variable and then run it by $wpdb->query() function. Something like following:

global $wpdb;
$query = "INSERT INTO ".$wpdb->prefix."mec_events ......";

Note: The post_id column of mec_events table should match the Post ID of event otherwise they won't link together.

2.Importing Shortcodes

If you're exporting the shortcodes from your demo website and importing them into the client website. Please take care of predefined filtering options. For example the shortcode on your demo website might be set to show events of "BlahBlah" category but this category may not exist on client website so the shortcode simply won't find any events and it shows "No Event!" message at the front-end. The best approach is to completely reset predefined options of the shortcodes.

These meta fields should be empty in the shortcodes:

  1. label
  2. category
  3. location
  4. organizer
  5. tag
  6. author

BTW, If you want to import pre-filtered shortcodes into the client website, then make sure that the taxonomies exists on client website and the events are assigned to that taxonomy correctly otherwise the shortcode won't find anything due to mis-configuration.

3.Importing Taxonomies

You can use the current solution that you use for importing other WP taxonomies such as tags, categories, etc.

Overriding MEC Templates

The MEC is created by developers for developers! and it's highly developer friendly so you can simply override MEC templates into your theme and make it compatible with your theme style or use MEC filters/actions to customize it.

The MEC has some template files in the /path/to/modern-events-calendar/templates/ path, you can simply override them into your theme or child-theme. For example place them on the /path/to/theme/single-mec-events.php or /path/to/child-theme/single-mec-events.php

Overriding MEC Skin Templates

The MEC supports many skins for showing events and all of them are override ready! For example if you want to customize grid skin of MEC, then you can simply put the /path/to/modern-events-calendar/app/skins/grid/render.php into the /path/to/theme/webnus/modern-events-calendar/app/skins/grid/render.php

You can do it for all template files of all skins including single skin that is for showing single event page, monthly_view, full_calendar, cover, etc.

BTW, we recommend you to avoid overriding the files as much as you can and try to make it compatible with your theme using CSS/JS because if you override the files on your theme, then your clients may not be able to use new features of MEC after automatic update.

Please feel free to contact us if you have any questions. We will be more than happy to help you.