epl_mini_web_keys: which fields make mini web buttons
Description #
The list of listing fields EPL turns into mini web buttons on the single listing (the epl_buttons_single_property action). EPL makes one button for each field in the list that has a value.
Add a field to show another button, or take one out. Since 3.6 epl_listing_has_links() reads the same list, so a template that hides an empty buttons area sees your fields too.
Usage #
add_filter( 'epl_mini_web_keys', 'my_mini_web_keys' );
Parameters #
$keys (array)
Field (meta key) names. Default: property_com_mini_web, property_com_mini_web_2, property_com_mini_web_3.
Examples #
Add a field of your own:
function my_mini_web_keys( $keys ) {
$keys[] = 'my_brochure_site'; // A custom field holding a URL.
return $keys;
}
add_filter( 'epl_mini_web_keys', 'my_mini_web_keys' );
function my_brochure_site_label( $label ) {
return 'Brochure';
}
add_filter( 'epl_button_label_my_brochure_site', 'my_brochure_site_label' );
The default button text is "Mini Web" followed by the last character of the field name, so set the text with the epl_button_label_my_brochure_site filter.
Take a field out:
function my_mini_web_keys( $keys ) {
return array_diff( $keys, array( 'property_com_mini_web_3' ) );
}
add_filter( 'epl_mini_web_keys', 'my_mini_web_keys' );
Notes #
- To hide one button without changing the list, return false from
epl_show_{field}, for exampleadd_filter( 'epl_show_property_com_mini_web', '__return_false' );. - Change a button's text with
epl_button_label_{field}, or for all of themepl_button_label_mini_web(see epl_button_label_mini_web). - Each button has the class
epl-mini-web-linkandepl-mini-web-link-{number}.
Related #
- Conditional tags:
epl_listing_has_links()andepl_listing_has_any_meta().
Source #
lib/hooks/hook-mini-web.php, in epl_button_mini_web() (since 3.4.37), and lib/includes/conditional-tags.php, in epl_listing_has_links() (since 3.6).