-
Notifications
You must be signed in to change notification settings - Fork 11
Custom Hooks
This hook is called straight after the opening <body> within Benenson's header.php file.
<?php
add_action( 'benenson_after_body_open_tag', function() {
// ...
} );
?>- benenson_mobile_nav_attrs
- benenson_kses_allowed_html
- benenson_add_a11y_to_tables
- benenson_add_async_handlers
- benenson_option_{$name}
- benenson_disable_emoji
- benenson_menu_link_attributes_ids
- benenson_polyfill_js
- benenson_bugsnag_development_domains
- benenson_bugsnag_staging_domains
- benenson_disable_rest_api
- benenson_disable_rest_api_json_error
- benenson_display_author
Filters the HTML attributes applied to a menu item's anchor element.
-
array$attrsArray of attributes to be added to the navigation<a>tag. -
WP_Post$itemMenu item data object. -
stdClass$argsAn object ofwp_nav_menu()arguments. -
integer$depthDepth of menu item. Used for padding.
<?php
add_filter( 'benenson_mobile_nav_attrs' function( $attrs, $item, $args, $depth ) {
// ...
} );
?>Sets which elements and attributes are allowed by wp_kses_post.
-
array$allowedArray of allowed html and attributes.
<?php
add_filter( 'benenson_kses_allowed_html' function( $allowed ) {
$allowed['section']['aria-label'] = true;
$allowed['section']['role'] = true;
return $allowed;
} );
?>Sets whether accessibility role attributes should be added to tables within post content.
-
boolean$applyWhether attributes should be added.
<?php add_filter( 'benenson_add_a11y_to_tables' '__return_true' ); ?>Adds async to scripts with one of the provided script handle names as defined by their wp_enqueue/register_script handler.
-
array $handlers List of handlers to add
asyncto.
<?php
add_filter( 'benenson_add_async_handlers', function( $handlers ) {
$handlers[] = 'my-async-script';
return $handlers;
} );
?>Allows for filtering of a Benenson theme option.
See list of available theme options
-
mixed$option Value of the given option. -
mixed$default Default value of the given option. -
string$name Name of the given option.
<?php
add_filter( 'benenson_option__logo', function( $option ) {
if ( empty( $option ) ) {
return 'my-logo.png';
}
return $option;
} );
?>Allows for disabling of emojis on the site.
-
boolean$disableWhether to disable emojis.
<?php add_filter( 'benenson_disable_emoji' '__return_true' ); ?>Provides a list of menu IDs have classes applied to within menu item links.
-
array$menu_idsList of menu_ids that should have class applied to.
<?php
add_filter( 'benenson_menu_link_attributes_ids' function( $menu_ids ) {
return [
'my-menu-id',
'category-menu',
];
} );
?>Sets whether JavaScript polyfills should be included and applied.
-
boolean$applyWhether polyfills should be applied.
<?php add_filter( 'benenson_polyfill_js' '__return_true' ); ?>Provides a list of domains that are part of the development stage. If BugSnag is enabled when an error occurs on a matching domain, stage will be set to development.
-
array$domainsList of domains or tlds that are part of the development stage.
<?php add_filter( 'benenson_bugsnag_development_domains' [ 'my-website.site' ] ); ?>Provides a list of domains that are part of the staging stage. If BugSnag is enabled when an error occurs on a matching domain, stage will be set to staging.
-
array$domainsList of domains or tlds that are part of the staging stage.
<?php add_filter( 'benenson_bugsnag_staging_domains' [ 'staging.my-site.com' ] ); ?>Sets whether to disable the REST API for users that are not logged in.
-
boolean$disabledWhether to disable the REST API.
<?php add_filter( 'benenson_disable_rest_api' '__return_true' ); ?>Sets whether the disabled REST API should respond with a JSON error. If set to false, a 300 redirection will occur.
-
boolean$show_errorWhether to display a JSON error.
<?php add_filter( 'benenson_disable_rest_api_json_error' '__return_true' ); ?>Enables/disables author information visibility in single.php.
-
boolean$show_authorWhether to display the author name. Defaultfalse.
<?php add_filter( 'benenson_display_author', '__return_true' ); ?>