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'. |
PHP
add_filter('wp-lemon/filter/phone-number/default-format', function () {
return 'international';
});
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. |
PHP
// Remove the German language from the switcher.
add_filter('wp-lemon/filter/language-switcher', function ($switcher) {
unset($switcher['de']);
return $switcher;
});
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. |
PHP
// Disable animation for all blocks.
add_filter('wp-lemon/filter/block/animation/hide', '__return_true');
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. |
PHP
// Disable animation for a specific block.
add_filter('wp-lemon/filter/block/section/animation/hide', '__return_true');
wp-lemon/filter/block/attributes
Filters the HTML attributes of the outer wrapper element of all blocks.
The attributes are rendered with the Twig html_attr function, so iterable values
become space separated lists, null/false values are omitted and true renders an empty attribute.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $html_attributes | array | The wrapper attributes.
|
| $post | \Timber\Post or null | The current post, if available. |
| $fields | array or false | The ACF fields of the block. |
| $attributes | array | The block attributes. |
PHP
add_filter('wp-lemon/filter/block/attributes', function ($html_attributes, $post, $fields, $attributes) {
$html_attributes['data-block'] = $attributes['name'];
return $html_attributes;
}, 10, 4);
wp-lemon/filter/block/{$slug}/attributes
Filters the HTML attributes of the outer wrapper element of a specific block.
$slug the block slug.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $html_attributes | array | The wrapper attributes, see wp-lemon/filter/block/attributes. |
| $post | \Timber\Post or null | The current post, if available. |
| $fields | array or false | The ACF fields of the block. |
| $attributes | array | The block attributes. |
PHP
add_filter('wp-lemon/filter/block/section/attributes', function ($html_attributes, $post, $fields, $attributes) {
$html_attributes['class'][] = 'section--custom';
return $html_attributes;
}, 10, 4);
wp-lemon/filter/block/inner-attributes
Filters the HTML attributes of the inner container of all full width, non-fluid blocks.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $html_attributes | array | The inner container attributes.
|
| $post | \Timber\Post or null | The current post, if available. |
| $fields | array or false | The ACF fields of the block. |
| $attributes | array | The block attributes. |
PHP
add_filter('wp-lemon/filter/block/inner-attributes', function ($html_attributes, $post, $fields, $attributes) {
$html_attributes['class'][] = 'my-inner-class';
return $html_attributes;
}, 10, 4);
wp-lemon/filter/block/{$slug}/inner-attributes
Filters the HTML attributes of the inner container of a specific full width, non-fluid block.
$slug the block slug.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $html_attributes | array | The inner container attributes, see wp-lemon/filter/block/inner-attributes. |
| $post | \Timber\Post or null | The current post, if available. |
| $fields | array or false | The ACF fields of the block. |
| $attributes | array | The block attributes. |
PHP
add_filter('wp-lemon/filter/block/section/inner-attributes', function ($html_attributes, $post, $fields, $attributes) {
$html_attributes['class'][] = 'section__container--wide';
return $html_attributes;
}, 10, 4);
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. |
PHP
// use the combined phone number if available (+31 (0)6 12345678)
add_filter('wp-lemon/filter/card/person/phonenumber', function ($default_number, $phone_numbers) {
return $phone_numbers['combined'];
}, 10, 2);
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. |
PHP
add_filter('wp-lemon/filter/card/excerpt-length', function () {
return 70;
});
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. |
PHP
add_filter('wp-lemon/filter/card/person/excerpt-length', function () {
return 70;
});
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. |
PHP
add_filter('wp-lemon/filter/card/news/animation/hide', '__return_true');
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. |
PHP
add_filter('wp-lemon/filter/card/news/animation', function ($animation) {
return 'fade-up';
});
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. |
PHP
add_filter('wp-lemon/filter/card/news/picture-classes', function ($picture_classes) {
$picture_classes[] = 'card__picture--rounded';
return $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. |
PHP
add_filter('wp-lemon/filter/card/person/picture-args', function ($args, $attachment_id) {
$args['focalpoint'] = true;
return $args;
}, 10, 2);
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/card/holder-attributes
Filters the HTML attributes of the card holder element of all cards.
The attributes are rendered with the Twig html_attr function, so iterable values
become space separated lists, null/false values are omitted and true renders an empty attribute.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $attributes | array | The holder attributes.
|
| $post | \Timber\Post or null | The post of the card, if available. |
| $fields | array or null | The fields if the current card is an ACF block. |
PHP
add_filter('wp-lemon/filter/card/holder-attributes', function ($attributes, $post, $fields) {
$attributes['class'][] = 'my-holder-class';
return $attributes;
}, 10, 3);
wp-lemon/filter/card/{$card_type}/holder-attributes
Filters the HTML attributes of the card holder element for a specific card type.
$card_type the post type dynamically set in the block.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $attributes | array | The holder attributes, see wp-lemon/filter/card/holder-attributes. |
| $post | \Timber\Post or null | The post of the card, if available. |
| $fields | array or null | The fields if the current card is an ACF block. |
PHP
add_filter('wp-lemon/filter/card/news/holder-attributes', function ($attributes, $post, $fields) {
$attributes['data-post-id'] = $post?->id;
return $attributes;
}, 10, 3);
wp-lemon/filter/card/attributes
Filters the HTML attributes of the card element (a.crd or div.crd) of all cards.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $attributes | array | The card attributes.
|
| $post | \Timber\Post or null | The post of the card, if available. |
| $fields | array or null | The fields if the current card is an ACF block. |
PHP
add_filter('wp-lemon/filter/card/attributes', function ($attributes, $post, $fields) {
if (isset($attributes['href'])) {
$attributes['aria-label'] = $attributes['title'];
}
return $attributes;
}, 10, 3);
wp-lemon/filter/card/{$card_type}/attributes
Filters the HTML attributes of the card element (a.crd or div.crd) for a specific card type.
$card_type the post type dynamically set in the block.
since 5.68.0
| Name | Type | Description |
|---|---|---|
| $attributes | array | The card attributes, see wp-lemon/filter/card/attributes. |
| $post | \Timber\Post or null | The post of the card, if available. |
| $fields | array or null | The fields if the current card is an ACF block. |
PHP
add_filter('wp-lemon/filter/card/news/attributes', function ($attributes, $post, $fields) {
$attributes['class'][] = 'crd--highlighted';
return $attributes;
}, 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. |
PHP
add_filter('wp-lemon/filter/block/node-overview/load-more-delay', function () {
return 200;
});
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');
wp-lemon/filter/cookiebar/show-preferences-checkbox
Filters whether or not to show the preferences checkbox in the cookie bar.
If applied, this will add a checkbox for the preferences cookies in the cookie bar.
This will lead to the following consent levels: personalization_storage
Default is false.
| 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-preferences-checkbox', '__return_true');
wp-lemon/filter/cookiebar/text
Filters the complementary text for the cookie bar.
| Name | Type | Description |
|---|---|---|
| $text | string | The text for the cookie bar. |
| $site_name | string | The site name. |
PHP
add_filter('wp-lemon/filter/cookiebar/text', function ($text) {
return 'Text shown in the cookie bar.';
});
wp-lemon/filter/cookiebar/functional
Filters the explanation text for the functional cookies in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $text | string | The text for the functional cookies. |
PHP
add_filter('wp-lemon/filter/cookiebar/functional', function ($text) {
return __('Functional cookies help the website work properly.', 'wp-lemon-child');
});
wp-lemon/filter/cookiebar/analytics
Filters the explanation text for the analytics cookies in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $text | string | The text for the analytics cookies. |
PHP
add_filter('wp-lemon/filter/cookiebar/analytics', function ($text) {
return 'Text shown in the cookie bar.';
});
wp-lemon/filter/cookiebar/marketing
Filters the explanation text for the marketing cookies in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $text | string | The text for the marketing cookies. |
PHP
add_filter('wp-lemon/filter/cookiebar/marketing', function ($type) {
return 'Text shown in the cookie bar';
});
wp-lemon/filter/cookiebar/preferences
Filters the explanation text for the preference cookies in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $text | string | The text for the preference cookies. |
PHP
add_filter('wp-lemon/filter/cookiebar/preferences', function ($type) {
return 'Text shown in the cookie bar';
});
wp-lemon/filter/cookiebar/reject
Filters the text for the reject button in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $reject | string | default: 'Reject' |
PHP
add_filter('wp-lemon/filter/cookiebar/reject', function ($type) {
return 'Text shown in the cookie bar';
});
wp-lemon/filter/cookiebar/accept
Filters the text for the accept button in the cookie bar.
| Name | Type | Description |
|---|---|---|
| $accept | string | default: 'Accept' |
PHP
add_filter('wp-lemon/filter/cookiebar/accept', function ($type) {
return 'Text shown in the cookie bar';
});
wp-lemon/filter/header/render
Filters whether or not to render the header.
This is intended to be used on custom landing pages where you want to hide the header.
| Name | Type | Description |
|---|---|---|
| $show_header | bool | True if the header should be shown, false if it should be hidden. |
PHP
add_filter('wp-lemon/filter/header/render', '__return_false');
wp-lemon/filter/header/navbar-brand
Filters the html of the .navbar-brand element
| Name | Type | Description |
|---|---|---|
| $navbar_brand_html | string | defaults to the navbar brand HTML. |
PHP
add_filter('wp-lemon/filter/header/navbar-brand', function () {
return Timber::compile('components/navbar-brand.twig');
});
Twig
<div class="navbar__logo-holder">
<div class="navbar__logo">{{ asset('images/logo.svg', 'contents') }}</div>
</div>
wp-lemon/filter/header/logo
Filters the logo HTML for the header.
| Name | Type | Description |
|---|---|---|
| $logo_html | string | defaults to the logo HTML. |
| $logo | array | The array containing the logo data. |
PHP
add_filter('wp-lemon/filter/header/logo', function () {
return Timber::compile('components/header-logo.twig');
});
Twig
<div class="navbar__logo">{{ asset('images/logo.svg', 'contents') }}</div>
wp-lemon/filter/header/breakpoint
Filters the breakpoint for the header.
This filter is used to determine the breakpoint at which the header will change its layout.
| Name | Type | Description |
|---|---|---|
| $breakpoint | string or false | default: 'lg', can be 'sm', 'md', 'lg', 'xl' or false to always show the offcanvas menu. |
PHP
add_filter('wp-lemon/filter/header/breakpoint', function () {
return 'xl';
});
Then based on the breakpoint set above, the offcanvas menu will adjust its layout accordingly.
In your _variables.scss file, define the menu breakpoints as follows:
$menu-breakpoints: (
xs: 0,
menu: 1198px,
) !default;
wp-lemon/filter/header/offcanvas/enable-onepager
Filters the boolean value to active the scroll listener for the offcanvas menu.
This filter comes in handy when you are working with a onepager website and you want to place anchor links in the offcanvas menu. This way, the offcanvas menu will scroll to the desired section when the menu item is clicked.
| Name | Type | Description |
|---|---|---|
| $activate_scroll_listener | bool |
PHP
add_filter('wp-lemon/filter/header/offcanvas/enable-onepager', '__return_true');
wp-lemon/filter/header/offcanvas/title
Filters the title of the offcanvas menu.
| Name | Type | Description |
|---|---|---|
| $title | string | The title of the offcanvas menu. |
PHP
function render_small_logo()
{
return asset('images/logo.svg')->contents();
}
add_filter('wp-lemon/filter/header/offcanvas/title', __NAMESPACE__ . '\render_small_logo');
wp-lemon/filter/header/offcanvas/open
Filters the svg icon HTML for the open icon of the offcanvas menu.
| Name | Type | Description |
|---|---|---|
| $open | string | The svg icon HTML for the open icon. |
PHP
add_filter('wp-lemon/filter/header/offcanvas/open', function ($open) {
return asset('images/hamburger.svg')->contents();
});
wp-lemon/filter/header/offcanvas/close
Filters the svg icon HTML for the close icon of the offcanvas menu.
| Name | Type | Description |
|---|---|---|
| $close | string | The svg icon HTML for the close icon. |
PHP
add_filter('wp-lemon/filter/header/offcanvas/close', function ($close) {
return asset('images/close.svg')->contents();
});
wp-lemon/filter/footer/render
Filters whether or not to render the footer.
This is intended to be used on custom landing pages where you want to hide the header.
| Name | Type | Description |
|---|---|---|
| $show_footer | bool | True if the footer should be shown, false if it should be hidden. |
PHP
add_filter('wp-lemon/filter/footer/render', '__return_false');
wp-lemon/filter/footer/show-logo
Filters if the logo should be shown in the footer.
| Name | Type | Description |
|---|---|---|
| $show_logo | bool | defaults to true. |
PHP
add_filter('wp-lemon/filter/footer/show-logo', '__return_false');
wp-lemon/filter/footer/show-bottombar
Filters if the bottombar should be shown in the footer.
The bottombar is the bar in the footer containing the copyright message and footer menu.
| Name | Type | Description |
|---|---|---|
| $show_bottombar | bool | defaults to true. |
PHP
add_filter('wp-lemon/filter/footer/show-bottombar', '__return_false');
wp-lemon/filter/footer/logo
Filters the logo HTML for the footer.
| Name | Type | Description |
|---|---|---|
| $logo_html | string | defaults to the logo HTML. |
| $logo | array | The array containing the logo data. |
PHP
add_filter('wp-lemon/filter/footer/logo', function () {
$context = Timber::context();
return Timber::compile('components/footer-logo.twig', $context);
});
wp-lemon/filter/copyright-message
Filters the copyright message for the footer.
| Name | Type | Description |
|---|---|---|
| $copyright_message | string | The copyright message. |
| $year | string | The current year. |
PHP
function filter_copyright_message($message)
{
return 'Copyright ' . date('Y') . ' - ' . get_bloginfo('name');
}
add_filter('wp-lemon/filter/copyright-message', __NAMESPACE__ . '\\filter_copyright_message');
wp-lemon/filter/entry-header/{$post_type}/tags
Filters the tags/categories in the entry header.
The output is formed like "tag1, tag2 and tag3" via the join twig function.
| Name | Type | Description |
|---|---|---|
| $tags | string | a joined string of tags. |
PHP
add_filter("wp-lemon/filter/entry-header/news/tags", function ($tags) {
return get_the_date() . " | " . $tags;
});
wp-lemon/filter/entry-header/{$post_type}/archive-page
Filters the back button information that leads back to the archive page.
| Name | Type | Description |
|---|---|---|
| $nav_back | array | An array containing the back button information. |
PHP
add_filter('wp-lemon/filter/entry-header/news/archive-page', function ($archive_page) {
$archive_page['url'] = get_permalink(get_option('page_for_posts'));
$archive_page['title'] = __('Back to news', 'wp-lemon-child');
return $archive_page;
});
wp-lemon/filter/entry-header/{$post_type}/type
Filters the post type name for the entry header.
This is shown above the title to indicate the post type.
| Name | Type | Description |
|---|---|---|
| $title | string | The title of the entry header. |
PHP
add_filter("wp-lemon/filter/entry-header/news/type", function ($type) {
return "News type text";
});
wp-lemon/filter/entry-header/{$post_type}/date
Filters the date html for the entry header.
Use this filter to change the date completely.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $date | string | The date HTML. |
PHP
add_filter("wp-lemon/filter/entry-header/news/date", "__return_false");
wp-lemon/filter/entry-header/{$post_type}/title
Filters the title html for the entry header.
Use this filter to change the title completely.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $title | string | The title HTML. |
PHP
add_filter('wp-lemon/filter/entry-header/news/title', function ($title) {
return get_the_title() . ' - ' . get_field('suffix');
});
wp-lemon/filter/entry-header/image-size
Filters the image size for the entry header.
Use this filter change the image size that is used in the entry header. Can be thumbnail, medium, large, full or any custom size.
| Name | Type | Description |
|---|---|---|
| $image_size | string | The image size, default: 'large'. |
PHP
add_filter('wp-lemon/filter/entry-header/image-size', function () {
return 'full';
});
wp-lemon/filter/entry-header/{$post_type}/image-size
Filters the image size for the entry header.
Use this filter change the image size that is used in the entry header. Can be thumbnail, medium, large, full or any custom size.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $image_size | string | The image size, default: 'large'. |
PHP
add_filter('wp-lemon/filter/entry-header/news/image-size', function () {
return 'full';
});
wp-lemon/filter/entry-header/{$post_type}/image-id
Filters the image ID for the entry header.
Use this filter to change the image ID of the entry header. You can use this filter to fall back to a default image if the image is not set.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $attachment_id | int | The attachment ID. |
PHP
add_filter('wp-lemon/filter/entry-header/news/image-id', function ($attachment_id) {
if (empty($attachment_id)) {
return get_theme_mod('fallback_image_news');
}
return $attachment_id;
});
wp-lemon/filter/entry-header/{$post_type}/picture-el
Filters the full picture element for the entry header.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $picture_html | string | The picture element HTML. |
| $post_id | int | The post ID. |
PHP
// this example shows how to replace the picture element with an oembed field if it exists for a news post type.
function overwrite_news_card_media($content, $id){
if (get_field('oembed',$id)){
return get_field('oembed',$id);
}
return $content;
}
add_filter('wp-lemon/filter/entry-header/news/picture-el', __NAMESPACE__ . '\\overwrite_news_card_media',10,2);
wp-lemon/filter/entry-header/person/archive-page
Filters the back button information that leads back to the archive page.
| Name | Type | Description |
|---|---|---|
| $nav_back | array | An array containing the back button information. |
PHP
add_filter('wp-lemon/filter/entry-header/person/archive-page', function ($nav_back) {
$nav_back['url'] = WP_Lemon_Site::get_special_page('team');
$nav_back['title'] = __('Back to team', 'wp-lemon-child');
return $nav_back;
});
wp-lemon/filter/entry-footer/share-buttons/show
Filters whether or not to show the share buttons in the entry footer.
| Name | Type | Description |
|---|---|---|
| $show_share_buttons | bool | Whether or not to show the share buttons, default: true. |
PHP
add_filter('wp-lemon/filter/entry-footer/share-buttons/show', '__return_false');
wp-lemon/filter/entry-footer/{$post_type}/share-buttons/show
Filters whether or not to show the share buttons in the entry footer for a specific post type.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $show_share_buttons | bool | Whether or not to show the share buttons, default: true. |
PHP
add_filter('wp-lemon/filter/entry-footer/faq/show-share-buttons', '__return_false');
wp-lemon/filter/entry-footer/share-buttons/platforms
Filters the share buttons for the entry footer.
Contains 'linkedin', 'x', 'facebook', 'e-mail', 'whatsapp'
You can change the order of the share buttons as well via this filter.
| Name | Type | Description |
|---|---|---|
| $share_buttons | array | The share buttons array. |
PHP
add_filter('wp-lemon/filter/entry-footer/share-buttons/platforms', function ($platforms) {
return ['linkedin', 'e-mail', 'whatsapp'];
});
wp-lemon/filter/entry-footer/{$post_type}/share-buttons/platforms
Filters the share platforms in the entry footer for a specific post type.
Contains 'linkedin', 'x', 'facebook', 'e-mail', 'whatsapp'
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $share_buttons | array | The share buttons array. |
PHP
add_filter('wp-lemon/filter/entry-footer/job/share-buttons/platforms', function ($platforms) {
return ['linkedin', 'e-mail', 'whatsapp'];
});
wp-lemon/filter/entry-footer/{$post_type}/share-buttons/post-type-name
Filters the post type name for the entry footer.
Use this if the share button sentence is vague.
| Name | Type | Description |
|---|---|---|
| $title | string | the post type name. |
PHP
add_filter('wp-lemon/filter/entry-footer/news/share-buttons/post-type-name', function ($title) {
return __('article', 'wp-lemon-child');
});
wp-lemon/filter/entry-footer/{$post_type}/share-buttons/title
Filters the title for the share buttons in the entry footer for a specific post type.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $title | string | the title of the entry footer. |
PHP
add_filter('wp-lemon/filter/entry-footer/news/share-buttons/title', function ($title) {
return __('Share this article', 'wp-lemon-child');
});
wp-lemon/filter/entry-footer/share-platforms/hide-labels
Filters whether or not to show the share platforms labels in the entry footer.
| Name | Type | Description |
|---|---|---|
| $show_labels | bool | Whether or not to show the labels, default: true. |
PHP
add_filter('wp-lemon/filter/entry-footer/share-platforms/hide-labels', '__return_false');
wp-lemon/filter/macro/picture/default-args
Filters the default arguments for the picture macro.
| Name | Type | Description |
|---|---|---|
| $args | array | The default arguments. |
PHP
add_filter('wp-lemon/filter/macro/picture/default-args', function($args) {
$args['focalpoint'] = true;
return $args;
});
wp-lemon/filter/single/templates
Filters the templates used to render a single post.
| Name | Type | Description |
|---|---|---|
| $templates | array | An array of template file names. |
| $post_type | string | The post type slug. |
| $post | \Timber\Post | The current post object. |
PHP
add_filter( 'wp-lemon/filter/single/templates', function ( $templates, $post_type, $post ) {
if ( is_post_type( [ 'partner', 'institute' ] ) ) {
$templates = [ 'templates/single-organisation.twig' ];
} elseif ( 'inspire' === $post_type ) {
$templates = [ 'templates/single-inspire.twig' ];
}
return $templates;
}, 10, 3 );
wp-lemon/filter/translations/frontend
Filters the front-end translations.
This filter is used to add or modify the translations array. The translations is used in javascript to translate strings.
| Name | Type | Description |
|---|---|---|
| $translations | string[] | An array of translations. |
PHP
function add_translations($translations)
{
return array_merge($translations, [
'name' => __('Name', 'wp-lemon-child'),
'apply' => __('Apply', 'wp-lemon-child'),
'sending' => __('Sending', 'wp-lemon-child'),
]);
}
add_filter('wp-lemon/filter/translations/frontend', __NAMESPACE__ . '\\add_translations');
wp-lemon/filter/header/scroll-settings
Filters default scroll values for the navigation bar.
This filter is used to add or modify the default scroll values.
since 5.49.0
| Name | Type | Description |
|---|---|---|
| $settings | array{disabled: bool, min_distance_to_top: int, min_scroll: int} | An array of scroll values. |
PHP
add_filter('wp-lemon/filter/header/scroll-settings', function ($settings) {
$settings['disabled'] = true;
return $settings;
});
wp-lemon/filter/translations/frontend
Filters the front-end translations.
This filter is used to add or modify the translations array.
PHP
function add_translations($translations)
{
return array_merge($translations, [
'name' => __('Name', 'wp-lemon-child'),
'apply' => __('Apply', 'wp-lemon-child'),
]);
}
add_filter('wp-lemon/filter/translations/frontend', __NAMESPACE__ . '\\add_translations');
wp-lemon/filter/frontend/script-data
Filters the front-end script data.
This filter is used to add or modify the data that is localized to the wplemon JavaScript object.
The data is available in JavaScript via the global wplemon variable.
| Name | Type | Description |
|---|---|---|
| $site | array | An array of script data.
|
PHP
add_filter('wp-lemon/filter/frontend/script-data', function ($site) {
$site['custom_api'] = 'https://api.example.com';
return $site;
});
wp-lemon/filter/block/accordion-item/allowed-blocks
Filters the allowed blocks for the accordion-item block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/accordion-item/allowed-blocks', function ($blocks) {
$blocks[] = 'core/image';
return $blocks;
});
wp-lemon/filter/block/card-grid/default-card
Filters the default card block for the card grid template.
| Name | Type | Description |
|---|---|---|
| $default_card | string | The default card block name. |
PHP
add_filter('wp-lemon/filter/block/card-grid/default-card', function ($default_card) {
return 'acf/icon-card';
});
wp-lemon/filter/block/card-grid/allowed-blocks
Filters the allowed blocks for the card grid block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/card-grid/allowed-blocks', function ($allowed_blocks) {
$allowed_blocks[] = 'acf/icon-card';
return $allowed_blocks;
});
wp-lemon/filter/block/carousel/allowed-blocks
Filters the allowed blocks for the carousel block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/carousel/allowed-blocks', function($blocks) {
$blocks[] = 'acf/icon-card';
return $blocks;
});
wp-lemon/filter/block/color-block/allowed-blocks
Filters the allowed blocks for the color-block block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/color-block/allowed-blocks', function ($blocks) {
$blocks[] = 'acf/custom-block';
return $blocks;
});
wp-lemon/filter/block/contact-cta/allowed-blocks
Filters the allowed blocks for the contact-cta block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/contact-cta/allowed-blocks', function ($blocks) {
$blocks[] = 'acf/form-block';
return $blocks;
});
wp-lemon/filter/block/image-sizes
Filters the default image sizes in blocks.
| Name | Type | Description |
|---|---|---|
| $image_sizes | string | the default image sizes. |
PHP
add_filter('wp-lemon/filter/block/image-sizes', function ($image_sizes) {
return '(min-width: 768px) 750px, 100vw';
});
wp-lemon/filter/block/content-card/image-sizes
Filters the default image sizes in the content-card block.
| Name | Type | Description |
|---|---|---|
| $image_sizes | string | the default image sizes. |
PHP
add_filter('wp-lemon/filter/block/content-card/image-sizes', function ($image_sizes) {
return '(min-width: 768px) 600px, 100vw';
});
wp-lemon/filter/block/content-card/fields/post-types
Filters the allowed post types to link to in the content-card block link field.
| Name | Type | Description |
|---|---|---|
| $post_types | array | the allowed post types. |
PHP
add_filter('wp-lemon/filter/block/content-card/fields/post-types', fn(): array => ['page', 'news', 'case']);
wp-lemon/filter/block/image-card/allowed-blocks"
Filters the allowed blocks for the image-card block.
| Name | Type | Description |
|---|---|---|
| $blocks | array | the allowed blocks. |
PHP
add_filter('wp-lemon/filter/block/image-card/allowed-blocks', function ($blocks) {
$blocks[] = 'core/paragraph';
return $blocks;
});
wp-lemon/filter/block/node-latest/{$post_type}/overview-button-text
Filters the overview button text for the node-latest block.
You can use this filter to change the button text on a per post type basis.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $overview_button_text | string | the button text |
| $label | string | the post type label |
PHP
add_filter('wp-lemon/filter/block/node-latest/news/overview-button-text', function ($text, $label) {
return __('View all news', 'wp-lemon-child');
}, 10, 2);
wp-lemon/filter/block/node-latest/{$post_type}/overview-button
Filters the overview button for the node-latest block.
You can use this filter to change the button on a per post type basis.
$post_type the post type dynamically set in the block.
since 5.46.1
| Name | Type | Description |
|---|---|---|
| $overview_button | array | the button array with link and text |
PHP
add_filter('wp-lemon/filter/block/node-latest/news/overview-button', function ($button) {
$button['link'] = get_permalink(get_page_by_path('news'));
$button['text'] = __('View all news', 'wp-lemon-child');
return $button;
});
wp-lemon/filter/block/node-latest/{$post_type}/args
Filters the query args for the node-latest block.
You can use this filter to change the query args on a per post type basis.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $args | array | the original query args |
| $post_id | int | the post id |
PHP
function ignore_noindexed_posts( $args ) {
$args['meta_query'] = [
'relation' => 'OR',
[
'key' => 'rank_math_robots',
'value' => 'noindex',
'compare' => 'NOT LIKE',
],
[
'key' => 'rank_math_robots',
'compare' => 'NOT EXISTS',
],
];
return $args;
}
add_filter( 'wp-lemon/filter/block/node-latest/case/args', __NAMESPACE__ . '\\ignore_noindexed_posts' );
wp-lemon/filter/block/node-latest/{$post_type}/items
Filters the items for the node-latest block.
You can use this filter to change the items on a per post type basis, or to short circuit the query if you want to provide your own items.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $items | array or null | the items to show in the block |
| $terms | array | the terms to filter on |
| $taxonomy | string or null | the taxonomy to filter on |
| $args | array | the query args |
PHP
function provide_own_items( $items, $terms, $taxonomy, $args ) {
$items = my_custom_query() ?? [];
return $items;
}
add_filter( 'wp-lemon/filter/block/node-latest/case/items', __NAMESPACE__ . '\\provide_own_items', 10, 4 );
wp-lemon/filter/block/node-latest/{$post_type}/no-items-message
Filters the no items message for the node-latest block.
You can use this filter to change the message on a per post type basis.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $no_items_message | string | the message |
| $terms | array | the terms |
| $term_name | false or string | the term name |
| $label | string | the post type label |
PHP
add_filter('wp-lemon/filter/block/node-latest/news/no-items-message', function ($message) {
return __('No news articles found.', 'wp-lemon-child');
}, 10, 4);
wp-lemon/filter/block/node-latest/{$post_type}/holder-classes
Filters the number of columns on lg format for the node-latest block.
You can use this filter to change the classes on a per post type basis.
$post_type the post type dynamically set in the block.
| Name | Type | Description |
|---|---|---|
| $col_lg_class | string | the number of columns |
PHP
add_filter('wp-lemon/filter/block/node-overview/person/holder-classes', fn($classes): string => 'col-6 col-lg-3');
wp-lemon/filter/block/node-latest/card-type
Filters the default card type for the node-latest block.
| Name | Type | Description |
|---|---|---|
| $card_name | string | the card name without the crd- prefix |
PHP
// If you want another card type instead of the default one, you can use this filter to change it.
add_filter('wp-lemon/filter/block/node-latest/card-type', function ($card_name) {
return 'news-small';
});