Signature
apply_filters( 'mam_gd_social_icons_only', bool $social_icons_only, int $listing_id );
| Parameter | Type | Description |
|---|---|---|
$social_icons_only |
bool | Default value, computed from the global option mam_geodirectory_social_icons_only. |
$listing_id |
int | The ID of the listing whose social section is being built. |
Returns: bool — true to render only icons (no labels), false to render icons with labels.
Purpose
Lets you override the social-media display per listing. The global option Mobile App Manager → Geodirectory → Settings → Social Links use Icons only controls the default; this filter lets a callback flip it for specific listings (e.g., based on a listing’s category, package, or custom flag).
When it runs
In mam_gd_content_blocks::mam_content_section_social_media:
$social_icons_only = ( get_option( 'mam_geodirectory_social_icons_only' ) === 'yes' );
$icons_only = apply_filters( 'mam_gd_social_icons_only', $social_icons_only, $data_array['id'] );
The filter fires once per listing whose detail screen is being built (and once per listing in the directory list when social fields are present).
Examples
Force icons-only for premium listings
add_filter( 'mam_gd_social_icons_only', 'my_app_premium_icons_only', 10, 2 );
function my_app_premium_icons_only( $icons_only, $listing_id ) {
$package_id = (int) geodir_get_post_meta( $listing_id, 'package_id', true );
if ( $package_id === 7 /* premium package id */ ) {
return true;
}
return $icons_only;
}
Always show labels (override the option)
add_filter( 'mam_gd_social_icons_only', static fn () => false );
Gotchas
- Affects only the social-media section. Tab bar buttons that link to social platforms are not gated by this filter.
- Boolean only. Returning a string like
'yes'will be truthy and behave as expected, but for clarity always return a real bool. - Per-listing call rate. Like the date-format filter, this fires for every listing with a social section. Cache per-request if your decision is expensive.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
includes/mam_gd_content_blocks.php(line 719)
Re-verify whenever the option key (mam_geodirectory_social_icons_only) changes, the social-media section’s filter call site is restructured, or the icons-only flag is consumed by a different downstream component.
Related articles
- Plugin: mam-geodirectory
- Listing detail content sections
- Recipe: Configure the GeoDirectory settings page
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-geodirectory |
| Applies to plugin version | 2.1.5+ |
| Category | Extending MAM Suite |
| Hook type | filter |
| Audience | PHP developer |
| Last verified | 2026-05-01 |
