Listing detail content sections

Primary responsibility

The mobile app’s listing detail screen is composed of “content sections.” Each section is a record with a title, a content payload, a type discriminator, and a show_title flag. mam-geodirectory contributes seven section types via the mam_content_section_* filter family (owned by mam-main). Admins enable, reorder, and rename them per content type in the App Settings → Layouts UI; this article documents what each section contains when it is enabled.

The seven section types are registered in mam_geodirectory_content::default_content_sections() and built by mam_gd_content_blocks in includes/mam_gd_content_blocks.php.

Reviews sections. When mam-reviews-manager is active, three more sections — reviews_header, reviews, and add_review — are available on the same listing detail screen. They are owned by mam-reviews-manager, not this plugin, and read/write native GeoDirectory ratings (including multi-criteria dynamics) through its provider. See Reviews content sections and How reviews are stored and read (provider model).


The seven sections

type Default title Built by When it appears
check_in_fav “On Screen Favorite” mam_content_section_check_in_fav Only for users who are not owner/manager/staff of the listing. Renders the favorite/check-in widget.
post_content “Post Content section” mam_content_section_post_content When the listing’s content is longer than 4 characters. Sends the listing’s content field as the section payload.
address_section “Address section” mam_content_section_address_section Always (unconditionally). Section type main_address — the app renders the listing’s address from the listing-row fields.
business_hours “Business Hours” mam_content_section_business_hours When business_hours is non-empty. Renders an HTML table of opening hours, deduplicating closed days.
social_media “Social Media” mam_content_section_social_media When at least one social-platform key is populated on the listing.
events “Events or Event Venue” mam_content_section_events For listings with linked events (via cp_link_posts) when not in events-only mode. Each linked event becomes a card.
event_details “Event Details” mam_content_section_event_details For gd_event posts only. Renders the event’s dates and times (from the serialized event_dates field) as an HTML table.

Each filter receives $sections, $data_array, $show_title, $title and returns a (possibly extended) $sections array. None of them mutate the listing’s fields — they only append to the section list.


Section payloads

check_in_fav

[
    'title'      => $title,            // default 'Main address' (intentionally — the section is title-shadowed by the address block)
    'content'    => '',
    'type'       => 'check_in_fav',
    'show_title' => $show_title,
]

The section is suppressed for owners/managers/staff because they have admin-style buttons instead (the favorite widget would conflict with management UI).

post_content

[
    'title'      => $title,            // default 'Description'
    'content'    => $data_array['content'],
    'type'       => 'main_desc',
    'show_title' => $show_title,
]

content is the post’s post_content after mam_localize_content (translation hook from mam-main) and shortcode stripping (a regex that removes [ ... ] blocks; apply_filters('the_content', ...) is then run). If the result is shorter than 4 characters the section is omitted entirely.

address_section

[
    'title'      => $title,
    'content'    => '',
    'type'       => 'main_address',
    'show_title' => $show_title,
]

The app renders the address from the listing’s street, city, state, region, zip, lat, lon fields. The section payload itself is empty.

business_hours

[
    'title'      => $title,
    'content'    => '<table style="width:100%">...</table>',
    'type'       => 'html',
    'show_title' => $show_title,
]

The HTML is built from geodir_schema_to_array() of the listing’s business_hours field, formatted as Mon | 9:00am - 5:00pm rows. Days where opens === closes are dropped.

social_media

[
    'title'      => $title,
    'content'    => [
        ['type' => 'facebook', 'url' => '...', 'name' => 'Facebook'],
        ...
    ],
    'type'       => 'social_media',
    'show_title' => $show_title,
]

Only platforms with a populated value on the listing are included (the row’s type/name come from an internal $social_map, and url is the value from the listing). When Hook: mam_gd_social_icons_only resolves true, the section also carries icons_only => 'yes'. Hook: mam_gd_social_icons_only per-listing toggles whether labels are hidden in favor of just the icon.

events

For listings (non-event), this enumerates the events linked to the listing via cp_link_posts (where post_id is an event and linked_id is this listing). Each event becomes a card object:

[
    'line_1_L'     => 'Live Music Friday',   // post title
    'line_2_L'     => '123 Main St',          // street
    'line_3_L'     => 'Austin, TX 78701',     // city_state_zip
    'imageurl'     => '...',
    'open_details' => $event_id,              // tapping opens this post
    'hide_image'   => 'yes',
    'layout_id'    => '6',
    ...
]

Cards are run through Hook: mam_geodirectory_event_card before being added to the section.

event_details

For gd_event posts:

[
    'title'      => $title,
    'content'    => '<table style="width:100%">...Date / Time rows...</table>',
    'type'       => 'html',
    'show_title' => $show_title,
]

The HTML table is composed from the event’s serialized event_dates (start/end dates and times, or the recurring-dates list), formatted with the mam_gd_date_format date format.


How the sections appear on screen

Order is admin-controlled — go to App Settings → Layouts → {Content type} → Detail. The default ordering is the order the sections are registered (check_in_fav, post_content, address_section, business_hours, social_media, events, event_details). Each section can be enabled/disabled and given a custom display title.

Admins can also add non-mam-geodirectory-owned sections — a chat section (from mam-chat-manager), a special-offers section (from mam-special-offers), and so on. Those are documented in their owning plugin.


Permissions awareness

mam_gd_content_blocks uses the shared mam_gd_user_roles trait to resolve, for each request, whether the current user is the listing’s owner, a manager, staff, or admin. Two sections currently use that information:

  • check_in_fav is hidden for owner/manager/staff.
  • (Several non-section behaviors elsewhere in the plugin also flow from this — see Listing tab bar buttons and Integration: Chat Manager.)

The trait reads is_admin from $this->allow_admin_to_do_stuff, but the content-blocks class does not currently set that property in its constructor (mam_gd_tab_bar_buttons does). The PLUGIN_AUDIT.md flagged this; in practice it means admins are not specially treated by the content-block sections — they’re treated as “not owner / not manager / not staff” and see the same sections as a regular subscriber. This is generally desirable on the detail screen.


Gotchas

  • Section list is determined per request. A change to the user (logging in/out, gaining/losing manager access) changes which sections appear immediately on the next data fetch.
  • address_section is always included even when no address fields are populated. The app handles empty addresses gracefully; if you need to suppress it conditionally, drop the section in a downstream filter.
  • business_hours HTML uses inline styles. Don’t rely on app-side CSS overrides to restyle it without checking the rendered HTML; the font-family: Roboto is hard-coded.
  • Events section is suppressed in events-only mode. The calendar content type doesn’t render this section.

Verification

This article was last verified against:

  • Plugin: mam-geodirectory v2.1.5
  • Source: includes/mam_gd_content_blocks.php
  • Source: content-classes/local-app-geodirectory-v2-class.phpdefault_content_sections()

Re-verify whenever a section type is added or removed in default_content_sections(), the mam_content_section_* filter signatures change in mam-main, or the role-trait wiring in mam_gd_content_blocks is changed.


  • Plugin: mam-geodirectory
  • Content type: GeoDirectory list and map
  • Listing tab bar buttons
  • Mobile listing data shape
  • Hook: mam_geodirectory_event_card
  • Hook: mam_gd_social_icons_only
  • Hook: mam_gd_date_format
  • Reviews content sections
  • How reviews are stored and read (provider model)

Metadata

Field Value
Article type Screen Reference
Plugin slug mam-geodirectory
Applies to plugin version 2.1.5+
Category App Settings Reference
Audience WordPress admin
Last verified 2026-05-01
Was this article helpful?
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!