Skip to content

v1.0.3

Latest

Choose a tag to compare

@pixelwatt pixelwatt released this 06 Oct 02:48

Meta Field — The Event's Details Columns

A new meta field outputs the event's details, venue and organizer as columns, like the meta section of The Events Calendar's default single event template, with two differences: the map is left out, and the venue, which TEC sets apart beside the map, is a column alongside the others.

  • meta field — {"field":"meta"} outputs a .method-tec-meta container with one .method-tec-meta__group column per group that has data, in the order --details, --venue, --organizer. Each column is an h3.method-tec-meta__title and a ul.method-tec-meta__list of li.method-tec-meta__item entries, with .method-tec-meta__label and .method-tec-meta__value spans wherever TEC shows a label. Every item carries a modifier class naming it.
  • Details — the rows TEC shows for all-day, multi-day and single-day events (--start-date and --end-date, --date, --start-datetime and --end-datetime, or --date and --time), with the time zone in a .method-tec-meta__timezone span when TEC's Show time zone setting is on; then cost (--cost), categories (--categories), tags (--tags) and the event website (--website). Dates are <time datetime="…"> elements rather than TEC's <abbr title="…">.
  • Venue — only when the event has a venue: the name (--venue-name), the address with TEC's map link inside an <address> (--address), phone (--phone) and website (--website). Address, phone and website are left out when the venue is password protected, as in TEC's template.
  • Organizer — only when the event has an organizer: each organizer's linked name (--organizer-name), then phone (--phone), email (--email) and website (--website) when there is a single organizer that isn't password protected. The heading is TEC's singular or plural organizer label.
  • TEC's strings — headings and labels use TEC's own strings and text domain, so translations and the venue and organizer label settings apply, and the tribe_events_single_event_time_title and tribe_events_single_event_time_formatted filters are honoured.
  • TEC's actions fire — tribe_events_single_meta_before and _after around the output, tribe_events_single_event_meta_primary_section_start and _end inside the container, and the details, venue and organizer _section_start and _section_end actions (with tribe_events_single_meta_details_section_after_datetime) inside the lists. Each is captured and placed where TEC's template places it. With Events Calendar Pro active that brings in the organizer phone and email visibility settings, the series link, the virtual event link, the venue name linked to its page, and the "Other" additional fields group, which becomes a further column.
  • No map — the map is never part of the field; the map field remains the way to output it.
  • Column styles — a small stylesheet is added inline, under the method-tec-data-helper-meta handle, the first time the field renders: the container is a wrapping flex row with a --method-tec-meta-gap gap (2rem by default); on desktop every column is the same width, however many there are; on tablet at most two columns share a row; on mobile there is one column. Lists lose their bullets, labels are bold on their own line, and the address loses its italics. Anything else is left to the theme.
  • Breakpoints — Method's block breakpoints when the theme is active (with the default dimensions: mobile below 768px, tablet from 768px to 1199px, desktop from 1200px), and those same values otherwise.
  • method_tec_data_helper_meta_styles filter — the CSS string, with the breakpoints as the second argument. Return an empty string to leave styling to the theme entirely.
  • New method_render_event_meta( $event_id ) — the function behind the field, usable on its own. Call it while the template is rendering so the styles are enqueued in time.
  • Not an event — nothing is output, without the wrapper.

Add to Calendar Field — TEC's Dropdown

A new add-to-calendar field outputs The Events Calendar's "Add to calendar" dropdown for the event, as TEC's default single event template shows it under the content.

  • add-to-calendar field — {"field":"add-to-calendar"} outputs TEC's dropdown: a .tribe-events-c-subscribe-dropdown button that opens a list of Google Calendar, iCalendar, Outlook 365 and Outlook Live links, each built by TEC's own link classes. TEC's visibility filters (tec_views_v2_subscribe_link_visibility and the per-link tec_views_v2_subscribe_link_{slug}_visibility) and theme overrides of its v2/components/subscribe-links templates apply. With one link visible TEC shows a single button instead, and with subscribe links turned off through tec_views_v2_use_subscribe_links it shows its classic Google Calendar and iCalendar buttons.
  • Single event pages only — TEC builds these links from the global post and only on a single event page, so the field outputs nothing elsewhere, such as in a Query Loop on the events archive. On an event page it follows the block's post: another event's links can be output, say in a related events loop, because that event is swapped in while rendering.
  • Password protected — nothing is output for a password-protected event, as in TEC's template.
  • Assets — TEC's tribe-events-views-v2-skeleton styles, its tribe-events-views-v2-full styles unless TEC's stylesheet setting is Skeleton, and its tribe-events-views-v2-ical-links script are enqueued once per request. TEC prints these styles the moment they are enqueued, and in a block theme the template renders before wp_head, so the enqueue waits for wp_enqueue_scripts to keep them in <head>; rendered later than that, they are printed in place. TEC loads them on single event pages anyway; this covers themes that keep TEC's view assets off.
  • No empty wrapper — when there is nothing to show the block returns an empty string, without the wrapper element.
  • New method_render_event_calendar_links( $event_id ) — the function behind the field, usable on its own. Call it while the template is rendering so the assets are enqueued in time.

Fixed — venue Field After the meta Field

Events Calendar Pro hooks tribe_events_single_meta_before to link the next venue name to the venue's page, and removes itself once used. On an event without a venue the meta field fires the action but never asks for a venue name, so the link filter would still be waiting when a later venue field asked for one, and that field would output an escaped, empty link.

  • Now skipped without a venue — the venue field outputs nothing (inside its wrapper, as before) when the event has no venue, so the waiting filter is never triggered by it.

Housekeeping

  • Version bumped to 1.0.3.