WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Custom display of grouping (8 posts)

  1. Daedalon
    Member
    Posted 1 year ago #

    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:

    1. 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 of dbem_event_list_groupby_format from the database should be done in this function or earlier, but plugin devs can likely figure that part out in moments.
    2. 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.

    3. 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.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    if you are using shortcode [events_list_grouped mode="monthly"] ; you can add this attribute date_format="F Y"

    if you are using settings > formats/layouts > Events page grouping ; you can change the headings using WP Settings > General > Date Format

    http://codex.wordpress.org/Formatting_Date_and_Time

  3. Daedalon
    Member
    Posted 1 year ago #

    With the shortcode we got the date to be displayed correctly. Thanks a lot!

    Hopefully the next update makes it possible to set this while using the Settings > Formats/Layouts > Events page grouping and adds the ability to format the header as described above.

  4. Daedalon
    Member
    Posted 1 year ago #

    I ran into a problem with the workaround when trying to use the [event_search_form], which requires an event list page to be set.

    • If I use the EM-generated event list page as the home page, the search works as intended, but the page itself shows incorrectly formatted dates as this EM-generated page does not respect EM's setting for grouping date formatting (see first post).
    • If I use a page with `[event_search_form]
      [events_list_grouped mode="daily" date_format="D j.n."]` as the front page, the date formatting is correct, but the search redirects users to a different page (the one set as the EM-generated event list page). This separate search page then shows incorrectly formatted dates.
  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    chances are you need to format the dates in your events list formats within Events > Settings > Formats/Layouts > Event Formats

  6. Daedalon
    Member
    Posted 1 year ago #

    That's the issue; Events > Settings > Formats/Layouts > Event Formats > Events page grouping setting is ignored.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    I'm confused, you're saying there's incorrectly formatted grouped dates, but then how can they be grouped fi the above is ignored?

  8. Daedalon
    Member
    Posted 1 year ago #

    Yes, it's a bit confusing since two settings have the same name. Didn't notice this before:

    Events page grouping [Daily]
    If you choose a group by mode, your events page will
    Events page grouping 	[l j.n.]
    Choose how to format your group headings. Leave blank for defaults. Date and Time formats follow the WordPress time formatting conventions

    The latter EM setting (eg. l j.n.) is ignored and the WP general date setting (eg. j.m.Y) is used instead. The first setting works as intended. Things to fix:

    • Make the second setting take effect.
    • Rename it to eg. Events page grouping formatting to avoid confusion.

    What I'd absolutely also love:

    • Add two settings to configure the HTML before and after the formatting. Just like events list has "Default event list format header", "Default event list format" and "Default event list format footer", so this is mostly a matter of reusing that code. Example of the resulting settings:
      Events page grouping [Daily]
      If you choose a group by mode, your events page will
      Events page grouping formatting header	[<div class="events-grouping-header">]
      Events page grouping formatting	[l j.n.]
      Choose how to format your group headings. Leave blank for defaults. Date and Time formats follow the WordPress time formatting conventions
      Events page grouping formatting footer	[</div>]
    • At the same go, it's a good time to fix the abruptly-cut sentence above that ends "...page will".

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.