Summary
A “content class element” is a reusable UI section that content classes (Login, Map, WP Post Content, etc.) assemble into per-screen output. Rather than each content class duplicating the markup-shape logic for “add to cart” or “featured image” or “social media”, it fires a filter and gets back a content_sections[] entry to append.
A content class is the per-screen handler. An element is a reusable section a content class composes into its output.
Where it appears
Inside the content_sections array on any per-screen JSON payload:
"content_sections": [
{ "title": "Featured", "content": "...", "type": "featured_image", "show_title": false },
{ "title": "Order details", "content": "...", "type": "order_details", "show_title": true },
...
]
Pattern
Every element function follows this shape:
function mam_main_content_element_<name>( $data_array, ...args ) {
$data_array['content_sections'][] = array(
'title' => ...,
'content' => ...,
'type' => '<name>',
'show_title' => ...,
);
return $data_array;
}
add_filter( 'mam_main_content_element_<name>', 'mam_main_content_element_<name>', 10, N );
Element filters registered
| Filter | Args | Purpose |
|---|---|---|
mam_main_content_element_show_shipping_status |
2 | (Stub — returns input unchanged; live impl below) |
mam_main_content_element_add_to_cart |
3 | Append add-to-cart section (WooCommerce) |
mam_main_content_element_make_offer |
2 | Append make-offer section (login-gated) |
mam_main_content_element_show_simple_product |
3 | Append simple WooCommerce product section |
mam_main_content_class_featured_image |
2 | Featured image block |
mam_main_content_element_chat_config |
3 | Chat thread config block |
mam_main_content_element_order_details |
3 | WooCommerce order details |
mam_main_content_element_seller_profile |
2 | Seller / vendor profile block |
mam_main_content_element_html |
2 | Raw HTML block |
mam_main_content_element_spacer |
2 | Vertical spacer |
mam_main_content_element_check_in |
2 | Check-in / RSVP button |
mam_main_content_element_social_media |
2 | Social media links |
mam_main_content_element_shipping_status |
2 | (Live impl) Shipping status block |
mam_add_featured_image |
3 | Featured image (alternate name) |
mam_main_content_class_reviews |
2 | Reviews block |
Sub-filter hooks
Several elements fire a *_args filter so external code can override default labels, login-prompt copy, or other parameters before the element is appended:
mam_main_content_element_add_to_cart_argsmam_main_content_element_make_offer_args
Reads / Writes
None — pure data transformation. No DB reads, no options, no globals.
Common recipes
Use a content element from inside a custom content class:
$data_array = apply_filters( 'mam_main_content_element_featured_image', $data_array, $post_id );
Override the add-to-cart label:
add_filter( 'mam_main_content_element_add_to_cart_args', function ( $args ) {
$args['button_label'] = 'Buy now';
return $args;
} );
Replace the shipping-status stub with a live implementation:
add_filter( 'mam_main_content_element_show_shipping_status', 'my_real_shipping_status', 20, 2 );
Gotchas
mam_main_content_element_show_shipping_statusis a stub that returns input unchanged. The real implementation ismam_main_content_element_shipping_status(without theshow_prefix). Both filter names exist; sibling plugins often replace the stub.- “Element” vs “class” terminology — content class is the per-screen handler; element is a reusable section a content class assembles into its output. The two terms are not interchangeable.
- Procedural file, not a class. Loaded via the
register_*()cascade inmam-main.php. There’s no central registry — you discover elements by readinggeneral-elements.php.
Related articles
- Content classes overview
- Content class: WP Post Content
- Mobile JSON shape
Metadata
| Field | Value |
|---|---|
| Article type | JSON Key Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Category | App Settings Reference |
| Audience | PHP developer |
| Source file | includes/content-class-elements/general-elements.php |
| Last verified | 2026-05-02 |
