Filter hooks reference
The following filter documentation is automatically generated.
wp-lemon/filter/phone-number/result
Filters the phone number result.
Use this filter to modify the phone number result.
| Name | Type | Description |
|---|---|---|
| $result | string[] | The phone number result. |
| $countrycode | int | The country code of the phone number. |
PHP
function filter_phone_numbers(array $result, int $countrycode): array
{
if (31 === $countrycode && str_starts_with($result['national'], '0180')) {
$result['combined'] = add_spaces_to_phonenumber($result['combined'], [3, 6, 2, 2]);
}
return $result;
}
add_filter('wp-lemon/filter/phone-number/result', __NAMESPACE__ . '\\filter_phone_numbers', 11, 2);
wp-lemon/filter/phone-number/default-format
wp-lemon/filter/phone-number/default-formatwp-lemon/filter/phone-number/default-format
Filters the default phone number format.
Can be one of the following:
- national (default)
- international (+31 6 12345678)
- combined (+31 (0) 6 12345678)
- localized (only if WPML is active and the current language is not the default language)
| Name | Type | Description |
|---|---|---|
| $default_format | string | Default phone number format, defaults to 'national'. |
wp-lemon/filter/language-switcher
Filters the language switcher.
By using this filter you can change the output of the language switcher.
| Name | Type | Description |
|---|---|---|
| $switcher | array<string,mixed> | The language switcher array. |
wp-lemon/filter/share-context
Filters the loaded card type for the node-latest block.
| Name | Type | Description |
|---|---|---|
| $shares | array<string,mixed> | an array of shares that can be addressed by the share partial. Array format: 'name' 'icon_class' 'share_url' |
PHP
add_filter('wp-lemon/filter/share-context', function (array $context): array {
$context['linkedin']['icon_class'] = 'icon-logo-linkedin';
$context['x']['name'] = 'X';
return $context;
});
wp-lemon/filter/social-platforms
Filters the social platforms available.
Use this filter to create additional social platform as well in the Customizer.
since 5.44.3
| Name | Type | Description |
|---|---|---|
| $platforms | array<string,string> | An array of social platforms where the key is the platform slug and the value is the platform name. |
PHP
add_filter('wp-lemon/filter/social-platforms', function ($platforms) {
$platforms['tiktok'] = 'TikTok';
return $platforms;
});
wp-lemon/filter/socials-order
Filters the order or add/remove social media platforms.
We use this filter to change the order of social media platforms in the footer.
| Name | Type | Description |
|---|---|---|
| $social_media_platforms | array | An array of social media platforms. |
PHP
add_filter(
'wp-lemon/filter/socials-order',
function () {
return ['linkedin', 'x', 'facebook', 'instagram', 'youtube'];
}
);
wp-lemon/filter/socials-context
Filters the socials context.
This filter can be used to change the socials that are being outputted.
| Name | Type | Description |
|---|---|---|
| $socials | array<int or string,array> | array of socials that can be addressed by the socials partial. |
PHP
add_filter('wp-lemon/filter/socials-context', function ($context) {
$context['linkedin']['icon_class'] = 'wp-lemon-icon-logo-linkedin-solid';
return $context;
});
wp-lemon/filter/block/animation/hide
Filters whether or not to add an animation to the block.
| Name | Type | Description |
|---|---|---|
| $maybe_hide_animation | bool | false in the frontend, true in the backend. |
wp-lemon/filter/block/{$slug}/animation/hide
Filters whether or not to hide the animation of a specific block.
Use this filter to toggle the animation for a specific block.
$slug the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $maybe_hide_animation | bool | false in the frontend, true in the backend. |
wp-lemon/filter/date-notation
Filters the default date notation
This filter is used in search results, news cards and the entry header.
| Name | Type | Description |
|---|---|---|
| $date_notation | string | The date notation. |
PHP
add_filter('wp-lemon/filter/date-notation', function($date_notation) {
return 'F j, Y';
});
wp-lemon/filter/card/person/phonenumber
Filters the phonenumber that is displayed in the person card.
see More information about what the phone number array contains: https://studio-lemon.github.io/wp-lemon-docs/reference/api-functions#format_phone_number
| Name | Type | Description |
|---|---|---|
| $default_number | string | The default number. |
| $phone_numbers | array | The phone numbers array containing the phone number information. |
wp-lemon/filter/card/icon
Filters the card icon.
| Name | Type | Description |
|---|---|---|
| $icon | string | The icon class name. |
An example of how to use this filter: PHP
add_filter('wp-lemon/filter/card/icon', function($icon) {
return 'icon-arrow-right';
});
wp-lemon/filter/card/excerpt-length
Filters the card excerpt length.
| Name | Type | Description |
|---|---|---|
| $excerpt_length | int | The excerpt length. |
wp-lemon/filter/card/{$card_type}/excerpt-length
Filters the card excerpt length for a specific card type.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $excerpt_length | int | The excerpt length. |
wp-lemon/filter/card/{$card_type}/animation/hide
Filters whether or not to hide the animation.
Return true to hide the animation.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $maybe_hide_animation | bool | false in the frontend, true in the backend. |
wp-lemon/filter/card/{$card_type}/animation
Filters what animation to use for the card.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $animation | string | The AOS animation name. |
wp-lemon/filter/card/{$card_type}/image-id
Filters the image ID for the card.
Use this filter to change the image ID of the card. You can use this filter to fall back to a default image if the image is not set.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $attachment_id | int | The attachment ID. |
PHP
add_filter('wp-lemon/filter/card/news/image-id', function($attachment_id) {
if (empty($attachment_id)) {
return get_theme_mod('fallback_image_news');
}
return $attachment_id;
});
wp-lemon/filter/card/{$card_type}/image-sizes
Filters the image ID for the card.
Use this filter to change the image ID of the card. You can use this filter to fall back to a default image if the image is not set.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $attachment_id | int | The attachment ID. |
An example of how to use this filter: PHP
function overview_image_sizes($sizes)
{
return '
(min-width: 768px) 750px,
(min-width: 600px) 510px,
400px';
}
add_filter('wp-lemon/filter/block/node-overview/case/image-sizes', __NAMESPACE__ . '\\overview_image_sizes');
wp-lemon/filter/card/{$card_type}/picture-classes
Filters the picture classes for the card.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $picture_classes | array | The picture classes. |
wp-lemon/filter/card/{$card_type}/picture-el
Filters the picture element for the card.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $picture_el | string | The picture element. |
| $args | array | additional arguments to help you filter the picture element.
|
An example of how to use this filter: PHP
function overwrite_news_card_media($content, $id)
{
if (!get_field('video', $id)) {
return $content;
}
return Timber::compile('components/cards/video.twig', [
'video' => get_field('video', $id),
'id' => get_post_thumbnail_id($id),
]);
}
add_filter('wp-lemon/filter/card/case/picture-el', __NAMESPACE__ . '\\overwrite_news_card_media', 10, 2); description
wp-lemon/filter/card/picture-args
Filters the picture arguments to render the picture element in the card.
| Name | Type | Description |
|---|---|---|
| $args | array | the arguments used by the picture macro to render the picture element.
|
| $attachment_id | int | The attachment ID. |
PHP
function overwrite_person_card_media($args)
{
$args['focalpoint'] = true;
return $args;
}
add_filter('wp-lemon/filter/card/person/picture-args', __NAMESPACE__ . '\\overwrite_person_card_media', 10, 2);
wp-lemon/filter/card/{$card_type}/picture-args
Filters the picture arguments to render the picture element in the card.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $args | array | the arguments used by the picture macro to render the picture element.
|
| $attachment_id | int | The attachment ID. |
wp-lemon/filter/card/{$card_type}/footer
Filters the card footer for a specific card type.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $card_footer | string | The card footer. |
| $post_id | int | The post ID. |
| $fields | array or null | The fields if the current card is an ACF block. |
PHP
function custom_card_footer($card_footer, $post_id, $fields)
{
return Timber::compile('components/cards/custom-footer.twig', []);
}
add_filter("wp-lemon/filter/card/\{$card_type\}/footer", __NAMESPACE__ . '\\custom_card_footer', 10, 3);
wp-lemon/filter/block/node-overview/{$card_type}/load-more-text
Filters the load more text in the node overview block for a specific post type.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $load_more_text | string | The load more text. |
PHP
add_filter('wp-lemon/filter/block/node-overview/story/load-more-text', function ($text) {
return 'Meer verhalen';
}, 10, 1);
wp-lemon/filter/block/node-overview/load-more-delay
Filters the load more delay in the node overview block.
Set a delay in milliseconds between the fade-ins of the different cards when they get loaded.
| Name | Type | Description |
|---|---|---|
| $delay | int | The delay in milliseconds. |
wp-lemon/filter/block/node-overview/{$card_type}/load-more-delay
Filters the load more delay in the node overview block for a specific post type.
Set a delay in milliseconds between the fade-ins of the different cards when they get loaded.
$card_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $delay | int | The delay in milliseconds. |
PHP
add_filter('wp-lemon/filter/block/node-overview/load-more-delay', function () {
return 200;
});
wp-lemon/filter/block/accordion-item/icon
Filters the icon HTML for the accordion item block.
| Name | Type | Description |
|---|---|---|
| $html | string | The icon HTML. |
PHP
add_filter("wp-lemon/filter/block/accordion-item/icon", function ($html) {
return '<svg>...</svg>';
});
wp-lemon/filter/cookiebar/show-analytics-checkbox
Filters whether or not to show the analytics checkbox in the cookie bar.
Default is true.
| Name | Type | Description |
|---|---|---|
| $show_checkbox | string | True if the checkbox should be shown, false if it should be hidden. |
PHP
add_filter('wp-lemon/filter/cookiebar/show-analytics-checkbox', '__return_true');
wp-lemon/filter/cookiebar/show-read-more
Filters whether or not to show the read more link in the cookie bar.
Default is true.
| Name | Type | Description |
|---|---|---|
| $show_read_more | string | True if the read more link should be shown, false if it should be hidden. |
PHP
add_filter('wp-lemon/filter/cookiebar/show-read-more', '__return_true');
wp-lemon/filter/cookiebar/show-marketing-checkbox
Filters whether or not to show the marketing checkbox in the cookie bar.
If applied, this will add a checkbox for marketing cookies in the cookie bar, allowing users to opt-in or opt-out of marketing cookies.
This will lead to the following consent levels: ad_storage, ad_user_data and ad_personalization.
Default is true.
| Name | Type | Description |
|---|---|---|
| $show_checkbox | string | True if the checkbox should be shown, false if it should be hidden. |
PHP
add_filter('wp-lemon/filter/cookiebar/show-marketing-checkbox', '__return_true');