Skip to main content

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.

NameTypeDescription
$resultstring[]The phone number result.
$countrycodeintThe 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-format
  • wp-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)
NameTypeDescription
$default_formatstringDefault 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.

NameTypeDescription
$switcherarray<string,mixed>The language switcher array.

wp-lemon/filter/share-context

Filters the loaded card type for the node-latest block.

NameTypeDescription
$sharesarray<string,mixed>an array of shares that can be addressed by the share partial. Array format: 'name' 'icon_class' 'share_url'

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

NameTypeDescription
$platformsarray<string,string>An array of social platforms where the key is the platform slug and the value is the platform name.

wp-lemon/filter/socials-context

Filters the socials context.

This filter can be used to change the socials that are being outputted.

NameTypeDescription
$socialsarray<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.

NameTypeDescription
$maybe_hide_animationboolfalse 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.

NameTypeDescription
$maybe_hide_animationboolfalse 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.

NameTypeDescription
$date_notationstringThe 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

NameTypeDescription
$default_numberstringThe default number.
$phone_numbersarrayThe phone numbers array containing the phone number information.

wp-lemon/filter/card/icon

Filters the card icon.

NameTypeDescription
$iconstringThe 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.

NameTypeDescription
$excerpt_lengthintThe 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.

NameTypeDescription
$excerpt_lengthintThe 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.

NameTypeDescription
$maybe_hide_animationboolfalse 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.

NameTypeDescription
$animationstringThe 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.

NameTypeDescription
$attachment_idintThe 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.

NameTypeDescription
$attachment_idintThe 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.

NameTypeDescription
$picture_classesarrayThe 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.

NameTypeDescription
$picture_elstringThe picture element.
$argsarrayadditional arguments to help you filter the picture element.

  • $
    object post the post object.
  • $
    object loop the loop object.
  • $
    string card_type the card type.
  • $
    int attachment_id the attachment ID.
  • $
    string picture_classes the picture classes.
  • $
    string image_size the image size.
  • $
    \image_sizes the image sizes attribute.
  • $
    bool focalpoint whether or not to use the focal point.

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.

NameTypeDescription
$argsarraythe arguments used by the picture macro to render the picture element.

  • $
    string picture_class the picture classes.
  • $
    string image_size the image size.
  • $
    \image_sizes the image sizes attribute.
  • $
    bool focalpoint whether or not to use the focal point.
$attachment_idintThe attachment ID.

PHP

function overwrite_person_card_media($args)
{
$args['focalpoint'] = true;

return $args;
}
add_filter('wp-lemon/filter/card/\{$card_type\}/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.

NameTypeDescription
$argsarraythe arguments used by the picture macro to render the picture element.

  • $
    string picture_class the picture classes.
  • $
    string image_size the image size.
  • $
    \image_sizes the image sizes attribute.
  • $
    bool focalpoint whether or not to use the focal point.
$attachment_idintThe 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.

NameTypeDescription
$card_footerstringThe card footer.
$post_idintThe post ID.
$fieldsarray or nullThe 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.

NameTypeDescription
$load_more_textstringThe 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.

NameTypeDescription
$delayintThe 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.

NameTypeDescription
$delayintThe 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.

NameTypeDescription
$htmlstringThe 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.

NameTypeDescription
$show_checkboxstringTrue 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-marketing-checkbox

Filters whether or not to show the marketing checkbox in the cookie bar.

Default is false.

NameTypeDescription
$show_checkboxstringTrue 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.

Default is false.

NameTypeDescription
$show_checkboxstringTrue 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.

NameTypeDescription
$textstringThe text for the cookie bar.
$site_namestringThe 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.

NameTypeDescription
$textstringThe text for the functional cookies.

wp-lemon/filter/cookiebar/analytics

Filters the explanation text for the analytics cookies in the cookie bar.

NameTypeDescription
$textstringThe 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.

NameTypeDescription
$textstringThe 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.

NameTypeDescription
$textstringThe 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.

NameTypeDescription
$rejectstringdefault: '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.

NameTypeDescription
$acceptstringdefault: '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.

NameTypeDescription
$show_headerboolTrue if the header should be shown, false if it should be hidden.

PHP

add_filter('wp-lemon/filter/header/render', '__return_false');

Filters the logo HTML for the header.

NameTypeDescription
$logo_htmlstringdefaults to the logo HTML.
$logoarrayThe array containing the logo data.

PHP

add_filter('wp-lemon/filter/header/logo', function () {
return Timber::compile('partials/header-logo.twig');
});

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.

NameTypeDescription
$breakpointstringdefault: 'lg'

PHP

add_filter('wp-lemon/filter/header/breakpoint', function () {
return 'xl';
});

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.

NameTypeDescription
$activate_scroll_listenerbool

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.

NameTypeDescription
$titlestringThe title of the offcanvas menu.

wp-lemon/filter/header/offcanvas/open

Filters the svg icon HTML for the open icon of the offcanvas menu.

NameTypeDescription
$openstringThe svg icon HTML for the open icon.

wp-lemon/filter/header/offcanvas/close

Filters the svg icon HTML for the close icon of the offcanvas menu.

NameTypeDescription
$closestringThe svg icon HTML for the close icon.

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.

NameTypeDescription
$show_footerboolTrue if the footer should be shown, false if it should be hidden.

PHP

add_filter('wp-lemon/filter/footer/render', '__return_false');

Filters if the logo should be shown in the footer.

NameTypeDescription
$show_logobooldefaults 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.

NameTypeDescription
$show_bottombarbooldefaults to true.

PHP

add_filter('wp-lemon/filter/footer/show-bottombar', '__return_false');

Filters the logo HTML for the footer.

NameTypeDescription
$logo_htmlstringdefaults to the logo HTML.
$logoarrayThe array containing the logo data.

wp-lemon/filter/copyright-message

Filters the copyright message for the footer.

NameTypeDescription
$copyright_messagestringThe copyright message.
$yearstringThe 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.

NameTypeDescription
$arrayAn array of taxonomies.

PHP

add_filter("wp-lemon/filter/entry-header/news/tags", function ($tag) {
return get_the_date() . " | " . $tag;
});

wp-lemon/filter/entry-header/{$post_type}/archive-page

Filters the back button information that leads back to the archive page.

NameTypeDescription
$arrayAn array containing the back button information.

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.

NameTypeDescription
$titlestringThe 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.

NameTypeDescription
$datestringThe 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.

NameTypeDescription
$titlestringThe title HTML.

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.

NameTypeDescription
$image_sizestringThe image size, default: 'large'.

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.

NameTypeDescription
$image_sizestringThe image size, default: 'large'.

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.

NameTypeDescription
$attachment_idintThe 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.

NameTypeDescription
$picture_htmlstringThe picture element HTML.
$post_idintThe post ID.

PHP

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.

NameTypeDescription
$nav_backarrayAn array containing the back button information.

wp-lemon/filter/entry-footer/share-buttons/show

Filters whether or not to show the share buttons in the entry footer.

NameTypeDescription
$show_share_buttonsboolWhether 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.

NameTypeDescription
$show_share_buttonsboolWhether 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.

NameTypeDescription
$share_buttonsarrayThe share buttons array.

PHP

add_filter('wp-lemon/filter/entry-footer/share-buttons/platforms', function ($platforms) {
return array_diff($platforms, ['x', 'facebook']);
});

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.

NameTypeDescription
$share_buttonsarrayThe share buttons array.

PHP

add_filter('wp-lemon/filter/entry-footer/job/share-buttons/platforms', function ($platforms) {
return array_diff($platforms, ['x', 'facebook']);
});

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.

NameTypeDescription
$titlestringthe post type name.

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.

NameTypeDescription
$titlestringthe title of the entry footer.

wp-lemon/filter/entry-footer/share-platforms/hide-labels

Filters whether or not to show the share platforms labels in the entry footer.

NameTypeDescription
$show_labelsboolWhether 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.

NameTypeDescription
$argsarrayThe default arguments.

PHP

add_filter('wp-lemon/filter/macro/picture/default-args', function($args) {
$args['focalpoint'] = 'true';
return $args;
});

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.

NameTypeDescription
$translationsstring[]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

NameTypeDescription
$settingsarray{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/block/accordion-item/allowed-blocks

Filters the allowed blocks for the accordion-item block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/accordion/allowed-blocks

Filters the allowed blocks for the accordion block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/card-grid/allowed-blocks

Filters the allowed blocks for the card grid block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/carousel/allowed-blocks

Filters the allowed blocks for the carousel block.

NameTypeDescription
$blocksarraythe 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.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/contact-cta/allowed-blocks

Filters the allowed blocks for the contact-cta block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/image-sizes

Filters the default image sizes in blocks.

NameTypeDescription
$image_sizesstringthe default image sizes.

wp-lemon/filter/block/content-card/image-sizes

Filters the default image sizes in the content-card block.

NameTypeDescription
$image_sizesstringthe default image sizes.

wp-lemon/filter/block/content-card/fields/post-types

Filters the allowed post types to link to in the content-card block link field.

NameTypeDescription
$post_typesarraythe allowed post types.

wp-lemon/filter/block/faq-highlights/posts-per-page

Filters the amount of posts per page for the faq-highlights block.

NameTypeDescription
$blocksintthe amount of posts per page.

wp-lemon/filter/block/faq-highlights/allowed-blocks

Filters the allowed blocks for the faq-highlights block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/faq-highlights/overview-button-text

Filters the overview button text for the faq-highlights block.

NameTypeDescription
$overview_button_textstringthe overview button text.

wp-lemon/filter/block/image-card/allowed-blocks"

Filters the allowed blocks for the image-card block.

NameTypeDescription
$blocksarraythe allowed 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.

NameTypeDescription
$overview_button_textstringthe button text
$labelstringthe post type label

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

NameTypeDescription
$overview_buttonarraythe button array with link and text

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.

NameTypeDescription
$argsarraythe original query args
$post_idintthe 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}/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.

NameTypeDescription
$no_items_messagestringthe message
$termsarraythe terms
$term_namefalse or stringthe term name
$labelstringthe post type label

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.

NameTypeDescription
$col_lg_classstringthe number of columns

wp-lemon/filter/block/node-latest/card-type

Filters the default card type for the node-latest block.

NameTypeDescription
$card_namestringthe card name without the crd- prefix

wp-lemon/filter/block/node-latest/{$post_type}/card-type

Filters the card type for the specific post type of the node-latest block.

You can use this filter to change the card type on a per post type basis.

$post_type the post type dynamically set in the block.

NameTypeDescription
$card_namestringthe card name without the crd- prefix

wp-lemon/filter/block/node-overview/{$post_type}/args

Filters the additional arguments for the initial query in the node-overview block.

$post_type the post type dynamically set in the block.

NameTypeDescription
$argsnull or arrayThe arguments for the query.
$fieldsarrayThe fields of the block.

This example shows how to order the posts alphabetically in ascending order. PHP

function alphabatic_order()
{
return [
'orderby' => 'title',
'order' => 'ASC',
];
}

add_filter('wp-lemon/filter/block/node-overview/person/args', __NAMESPACE__ . '\\alphabatic_order');

wp-lemon/filter/block/node-overview/{$post_type}/select-all-text

Filters the text for the "all" option in the filter of the node-overview block.

$post_type the post type dynamically set in the block.

NameTypeDescription
$all_textstringThe text for the select all option.

wp-lemon/filter/block/node-overview/{$post_type}/holder-classes

Filters the holder classes for the cards in the node overview block.

$post_type the post type dynamically set in the block.

NameTypeDescription
$holder_classesstringThe holder classes for the block.

wp-lemon/filter/block/image-sizes

Filters the image sizes for all blocks.

NameTypeDescription
$image_sizesstringThe image sizes for the block.

wp-lemon/filter/block/node-overview/image-sizes

Filters the image sizes for the node overview block.

NameTypeDescription
$image_sizesstringThe image sizes for the block.

wp-lemon/filter/block/node-overview/{$post_type}/image-sizes

Filters the image sizes for the node-overview block.

$post_type the post type dynamically set in the block.

NameTypeDescription
$image_sizesstringThe image sizes for the block.

wp-lemon/filter/block/node-overview/{$post_type}/card-type

Filters the card_type for a specific post type used inside the node-overview block

You can use this filter to change the card type for a specific post type.

$post_type the post type dynamically set in the block.

NameTypeDescription
$card_typestringThe card type for the block.

wp-lemon/filter/block/node-overview/{$post_type}/items

Filters the posts that are going to be displayed in the initial load of the node-overview block.

You can use this filter to add additional posts to the initial load or add an additional card in a specific spot.

$post_type the post type dynamically set in the block.

NameTypeDescription
$items\Timber\PostCollectionInterface or nullThe posts that are going to be displayed in the initial load.

wp-lemon/filter/block/node-overview/{$post_type}/posts-per-page

Filters the amount of posts that are are being queried for the node-overview block.

This number is used for loads after the initial load.

$post_type the post type dynamically set in the block.

NameTypeDescription
$posts_to_queryintThe amount of posts to query for the block.

wp-lemon/filter/block/node-overview/{$post_type}/load-more-text

Filters the text for the load more button in the node-overview block.

You can use this filter to change the text for the load more button for a specific post type.

$post_type the post type dynamically set in the block.

NameTypeDescription
$load_more_textstringThe text for the load more button.

wp-lemon/filter/block/node-overview/{$post_type}/no-more-items-text

Filters the text for the "no more items" message in the node-overview block.

You can use this filter to change the text for the no more items message for a specific post type.

$post_type the post type dynamically set in the block.

NameTypeDescription
$no_more_items_textstringThe text for the no more items message.

wp-lemon/filter/block/node-overview/{$post_type}/load-more-action

Filters the Ajax Action for a specific post type in the node-overview block.

You can use this filter to change the action for the load more button for a specific post type.

$post_type the post type dynamically set in the block.

since 5.45.0

NameTypeDescription
$actionstringThe action for the load more button.
$fieldsarrayThe fields of the block.

wp-lemon/filter/block/timeline-item/allowed-blocks

Filters the allowed blocks for the timeline-item block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/block/widget-row/allowed-blocks

Filters the allowed blocks for the widget-row block.

NameTypeDescription
$blocksarraythe allowed blocks.

wp-lemon/filter/navwalker/archive-pages

Filters the archive page for the current post type.

Primarily used by the lemon-woo plugin to mark the shop page as the archive page for the product post type.

since 5.19.0

NameTypeDescription
$archive_pagesmixedThe archive page for the current post type.
$post_idintThe post ID of the current menu item.
$itemmixedThe current menu item.
$classesarrayThe current menu item classes.

Example usage:

PHP

function add_archive($archive_pages, $post_id, $item, $classes)
{

if ($post_id == wc_get_page_id('shop')) {
$archive_pages = array('product');
}

return $archive_pages;
}
add_filter('wp-lemon/filter/navwalker/archive-pages', __NAMESPACE__ . '\\add_archive', 10, 4);

wp-lemon/filter/navwalker/start-lvl-classes

Filters the classes for the start of a menu level.

since 5.35.0

NameTypeDescription
$div_class_namesarrayThe classes for the start of a menu level.
$depthintThe depth of the menu item.
$args\stdClassAn object of wp_nav_menu() arguments.
$current_item\WP_PostThe current menu item.

wp-lemon/filter/navwalker/start-lvl

Filters the output for the start of a menu level.

since 5.35.0

NameTypeDescription
$outputstringThe output for the start of a menu level.
$depthintThe depth of the menu item.
$args\stdClassAn object of wp_nav_menu() arguments.
$current_item\WP_PostThe current menu item.

wp-lemon/filter/navwalker/end-lvl

Filters the output for the end of a menu level just before the closing ul tag.

since 5.35.0

NameTypeDescription
$outputstringThe output for the end of a menu level.
$depthintThe depth of the menu item.
$args\stdClassAn object of wp_nav_menu() arguments.
$current_item\WP_PostThe current menu item.

wp-lemon/filter/navwalker/{$archive_page_post_type}/link-attributes

Filters the link attributes for a wp-lemon archive page.

$archive_page_post_type is the post type of the archive page.

NameTypeDescription
$attsarrayThe HTML attributes applied to the menu item's <a> element, empty strings are ignored.
$menu_item\WP_PostThe current menu item.
$args\stdClassAn object of wp_nav_menu() arguments.
$depthintDepth of menu item.

PHP

Example usage:
function link_attributes_job($atts, $item, $args, $depth)
{
$args = [
'post_type' => 'job',
'posts_per_page' => -1,
'status' => 'publish',
];

$posts = \Timber\Timber::get_posts($args);
$count = count($posts);

if ($count > 0) {
$atts['data-jobs'] = $count;
}

return $atts;
}
add_filter('wp-lemon/filter/navwalker/job/link-attributes', __NAMESPACE__ . '\\link_attributes_job', 10, 4);

Filters the link attributes for a menu item based on the menu item ID.

$menu_item_id is the ID of the menu item.

NameTypeDescription
$attsarrayThe HTML attributes applied to the menu item's <a> element, empty strings are ignored.
$menu_item\WP_PostThe current menu item.
$args\stdClassAn object of wp_nav_menu() arguments.
$depthintDepth of menu item.

Example usage:

PHP

function link_attributes_job($atts, $item, $args, $depth)
{

$args = [
'post_type' => 'job',
'posts_per_page' => -1,
'status' => 'publish',
];

$posts = \Timber\Timber::get_posts($args);
$count = count($posts);

if ($count > 0) {
$atts['data-jobs'] = $count;
}

return $atts;
}

add_filter('wp-lemon/filter/navwalker/10/link-attributes', __NAMESPACE__ . '\\link_attributes_job', 10, 4);

wp-lemon/filter/model/faq-slug

Filters the FAQ slug.

Use this filter to change the slug of the FAQ post type.

NameTypeDescription
$faq_slugstringThe FAQ slug.

wp-lemon/filter/faq/related-posts

Filters the number of related posts to query.

Defaults to 6.

NameTypeDescription
$itemsintThe number of items to query.

wp-lemon/filter/ajax-query/{$this->current_action}/context

Filters the context before rendering the cards.

This allows developers to add or remove context before rendering the cards.

NameTypeDescription
$contextarrayThe context array.
$instance\Generic_Ajax_QueryThe current instance of the class.

wp-lemon/filter/special-pages

Filters the special pages.

This filter allows you to add or remove special pages. You can read more about special pages in the documentation.

see

since 4.0.0 Special pages introduced.

NameTypeDescription
$special_pagesarrayThe special pages.

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.

NameTypeDescription
$social_media_platformsarrayAn array of social media platforms.

PHP

add_filter(
'wp-lemon/filter/socials-order',
function () {
return ['linkedin', 'x', 'facebook', 'instagram', 'youtube'];
}
);

Filters the array of skip links.

This allows developers to add or remove skip links.

since 4.1.0

NameTypeDescription
$linksarrayOriginal array of skip links.

PHP

add_filter('wp-lemon/filter/a11y/skip-links', function ($skip_links) {
unset($skip_links['navbar']);
$skip_links['menu'] = __('Skip to primary navigation', 'wp-lemon');
return $skip_links;
}, 10, 1);

wp-lemon/filter/palette

Filters the used palette JSON file.

Use this filter to load a different palette JSON file from your child theme.

since 5.46.0

NameTypeDescription
$palette_jsonstringThe palette JSON file name.

To use a custom palette JSON file, add the following code to your child theme's hooks.php: PHP

add_filter('wp-lemon/filter/palette', function($palette_json) {

if ('custom-variant' == get_constant('WEBSITE_VARIANT')) {
return 'palette-custom.json';
}

return $palette_json;
});

In your config.json, you can set a custom palette like this:

 "themeJsonFile": "palette-custom.json",

wp-lemon/filter/webp-quality

Filters the quality of the webp image.

since 4.9.2

NameTypeDescription
$qualityintThe quality of the webp image.

wp-lemon/filter/blocks

Filters the blocks to load.

With this filter you can remove blocks from the parent theme.

NameTypeDescription
$blocksstring[]array of blocks to load.

PHP

function allowed_vanilla_lemon_blocks($blocks)
{
return [
'accordion',
'accordion-item',
'card-grid',
'content-card',
'node-latest',
'node-overview',
'section',
'todo',
'widgets',
'widget',
];
}
add_filter('wp-lemon/filter/blocks', __NAMESPACE__ . '\\allowed_vanilla_lemon_blocks', 10, 1);

wp-lemon/filter/blocks-to-allow

Filters the allowlist of blocks that will be allowed in the editor.

This will override the block removal list and short-circuit the function.

since 5.35.0

NameTypeDescription
$blocksarray<string,mixed>to allow array of core blocks that we only want to show in the editor.
$post_typestringThe current post type. Use this to remove blocks for a specific post type.

PHP

function blocks_to_allow($blocks, $post_type)
{
// Add the core block 'core/quote' to the allowed blocks for the post type 'faq'.
switch ($post_type) {
case 'partner':
$blocks = [];
$blocks[] = 'core/paragraph';
$blocks[] = 'core/list';
$blocks[] = 'core/list-item';
$blocks[] = 'core/embed';
$blocks[] = 'core/heading';
$blocks[] = 'core/image';
$blocks[] = 'core/gallery';

// Add more cases if needed

default:
// Optional: handle other post types
break;
}

return $blocks;
}
add_filter('wp-lemon/filter/blocks-to-allow', __NAMESPACE__ . '\\blocks_to_allow', 10, 2);

wp-lemon/filter/core-blocks-to-allow

Filters the list of core blocks that will be allowed in the editor.

since 5.8.0 introduced the filter.

NameTypeDescription
$blocksarray<string,mixed>to allow array of core blocks that we only want to show in the editor.
$post_typestringThe current post type. Use this to remove blocks for a specific post type.
$registered_blocksstring[]Array of all registered blocks.

PHP

// remove all blocks except the ones we want
function filter_allowed_block_types()
{
return [
'core/paragraph',
'core/heading',
'core/list',
'core/list-item',
'core/image',
'core/embed',
'core/buttons',
'core/button',
'core/columns',
'core/column',
];
}
add_filter('wp-lemon/filter/core-blocks-to-allow', __NAMESPACE__ . '\\filter_allowed_block_types', 10);

wp-lemon/filter/core-blocks-to-remove

Filters the block removal list.

DEPRECATED since 5.35.0 Use wp-lemon/filter/blocks-to-remove instead. The name of the filter is misleading.

We have a list of blocks that we do not want to show in the editor, this filter allows us to remove blocks from that list.

NameTypeDescription
$blocks_to_removearray<string,mixed>array of blocks that we do not want to show in the editor.
$post_typestringThe current post type. Use this to remove blocks for a specific post type.

wp-lemon/filter/blocks-to-remove

Filters the block removal list.

We have a list of blocks that we do not want to show in the editor, this filter allows us to remove blocks from that list.

NameTypeDescription
$blocks_to_removearray<string,mixed>array of blocks that we do not want to show in the editor.
$post_typestringThe current post type. Use this to remove blocks for a specific post type.

PHP

 add_filter(
'wp-lemon/filter/blocks-to-remove',
function ($blocks) {
$core_blocks_to_remove = [
'core/details',
'core/code',
'core/preformatted',
'core/group',
'core/cover',
'core/audio',
'core/video',
'core/media-text',
'core/nextpage',
'core/quote',
'core/spacer',
'core/social-links',
'core/post-title',
'core/navigation',
'core/shortcode',
'searchwp/results-template',
'searchwp/search-form',
'rank-math/rich-snippet',
'rank-math/howto-block',
'rank-math/faq-block',
'rank-math/command',
'rank-math/toc-block',
];
return array_merge($blocks, $core_blocks_to_remove);
},10,1);

wp-lemon/filter/model/acf-fields/job

Filters the job post type fields registered with ACF.

since 3.11.4

NameTypeDescription
$person_fields\StoutLogic\AcfBuilder\FieldsBuilderThe fields for the job.

wp-lemon/filter/model/acf-fields/person

Filters the person post type fields registered with ACF.

since 3.11.4

NameTypeDescription
$person_fields\StoutLogic\AcfBuilder\FieldsBuilderThe fields for the job.

wp-lemon/filter/model/acf-fields/menu

Filters the menu fields registered with ACF.

since 3.11.4

NameTypeDescription
$menu_fields\StoutLogic\AcfBuilder\FieldsBuilderThe fields for the menu.