[Plugin: Events Manager] Custom display of grouping
-
The default grouping in events list is “<h2>Date</h2>”. Even if the already-added date formatting option would work, which it unfortunately does not do, we’re also looking for an option to customize the HTML around the date. I dug into the code and found out that supporting this is not far beyond even my meager skills.
The issue consists of two/three parts:
- admin/em-options.php contains contains this code on line 982:
em_options_input_text(__('Events page grouping','dbem'), 'dbem_event_list_groupby_format', __('Choose how to format your group headings. Leave blank for defaults.','dbem').' '. sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));to save a date formatting setting, but the saved setting is not referenced anywhere else. It seems that in em-template-tags.php right after the line 82 when the $args[] array value pairs for em_get_events_list_grouped() are set, ‘date_format’ is missing. I’m not familiar enough with the plugin to say whether checking the value ofdbem_event_list_groupby_formatfrom the database should be done in this function or earlier, but plugin devs can likely figure that part out in moments. - In em-template-tags.php, rows 109, 121, 139 and 151 should use before-date-HTML and after-date-HTML as arguments instead of having a hard-coded ‘<h2>’.datearguments.'</h2>’. These should of then be set in the em-options.php right before and after setting dbem_event_list_groupby_format, and the values of these variables should be queried to use. This might be best done at the same time as the abovementioned querying for the proper date formatting. After the variables are set and queried, line 151 would be changed from
echo '<h2>'.date_i18n($format,$event_day_ts).'</h2>';to become
echo $args['before-grouping'].date_i18n($format,$event_day_ts).$args['after-grouping'];Creating the options themselves shouldn’t be much more than copy-pasting admin/em-options.php’s lines 983 and 985, the ones that set dbem_event_list_item_format_header and dbem_event_list_item_format_footer.
- At the same time it’s good to finish this helper text in admin/em-options.php on line 981:
em_options_select(__('Events page grouping','dbem'), 'dbem_event_list_groupby', $grouby_modes, __('If you choose a group by mode, your events page will ','dbem'));
These two main things are now among the biggest things we need to refine on our front page to have it ready for launch. I’ll gladly help you patching the plugin to support these, at the very least by testing the development version.
- admin/em-options.php contains contains this code on line 982:
The topic ‘[Plugin: Events Manager] Custom display of grouping’ is closed to new replies.