Goal
Add a new button to the app, choose its content type, configure its per-button settings, place it on a screen or in the tab bar, and verify it renders for the intended roles.
Prerequisites
- Admin access to Mobile App Manager
- A content-type decision: do you want a Login button, a Map, a Web URL, a WP Post Category list, etc.? See Content classes overview for the full set of 21 types.
Steps
1. Open the Buttons admin
Mobile App Manager → Buttons lists every button currently configured for the active role. The dropdown at the top switches roles — buttons can have per-role variants.
2. Add a button
Click Add a Button. Pick a content type from the dropdown (e.g., Web URL, Map, WP Post Category). Enter a display title.
The button is now stored in the role’s local-app-button-array* option (frozen public contract). It appears in the list.
3. Configure per-button settings
Click the button to open its detail page. The settings tabs you see depend on the content class — each class declares its own categories via app_settings_categories().
For example, a Web URL button has tabs for the URL, the page title, whether to render in a webview or open in the system browser, and per-button colors.
A Map button has tabs for the marker source (post type / category), default zoom, whether the user’s location is shown.
A WP Post Category button has tabs for the category to render, the post fields to display in the list, and the detail screen layout.
Settings are saved through the mam_app_settings_set_button filter and persisted into the button’s blob inside local-app-button-array*.
4. (Optional) Restrict to specific roles
Some content types (Login, Logout, Favorites) only make sense for some roles. Switch to the role dropdown at the top of the Buttons page; if the button shouldn’t appear for a role, don’t add it for that role.
The phone-data pipeline reads buttons via apply_filters('mam_app_settings_get_buttons', false, $role, 'main'|'left'), so per-role separation is enforced at fetch time.
5. Place the button on a screen
Buttons aren’t placed automatically — they’re referenced from a screen layout, the home-screen stack, or the tab bar.
- Home screen: Mobile App Manager → Layout — drag the button into a layout section.
- Left menu: Mobile App Manager → Navigation → Left Menu — drag the button into the menu.
- Tab bar: Mobile App Manager → Navigation → Tab Bar — pick the button as one of the (up to 5) tabs.
6. (Optional) Wire up tab-bar enrichment
If your button appears on a detail screen’s tab bar (e.g., an Edit Listing button on a venue detail page) and needs per-listing logic — pre-populate a form, gate by user role, hide for unowned listings — register a mam_main_add_tab_bar_item_{slug} filter from your sibling plugin.
See Hook: mam_main_add_tab_baritem{slug} for the canonical pattern. Without a filter, the button uses the static admin configuration directly.
7. Verify in the Previewer
Open the Previewer app, switch to the role you configured, and walk to the screen. The button should appear with the configured title, icon, and behavior.
If it doesn’t appear:
- Check the Show Button toggle — if it’s off, the pipeline skips the button entirely.
- Check the role — buttons are per-role.
- For tab-bar enrichment buttons: if your
mam_main_add_tab_bar_item_{slug}filter returns[], the button is hidden. Returning a half-populated array breaks rendering — return either a complete button or[]. - Check
mamdebugoutput for'missing tabbar'entries (logged when a tab-bar dispatch finds no matching filter).
Verification
- The button appears in Mobile App Manager → Buttons for the configured role.
- The button is selectable in the layout / left-menu / tab-bar admin where you placed it.
- The button renders in the Previewer app for the right role.
- For dynamic tab-bar buttons, the filter callback fires once per item per app load (verify with a
mamdebuglog inside the callback).
Related articles
- Content classes overview
- Recipe: Configure the tab bar
- Hook: mam_app_settings_get_buttons
- Hook: mam_app_settings_get_setting
- Hook: mam_tab_manager
- Hook: mam_main_add_tab_baritem{slug}
- Hook: mam_main_skip_tab_bar_button
- Frozen public contracts reference
Metadata
| Field | Value |
|---|---|
| Article type | Recipe (Admin) |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Category | Building Your App |
| Audience | WordPress admin |
| Estimated time | 10–20 minutes |
| Last verified | 2026-05-02 |
