This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Custom Hooks
Paul Taylor edited this page Nov 23, 2018
·
10 revisions
This hook is called straight after the opening <body>
within Benenson's header.php
file.
<?php
add_action( 'benenson_after_body_open_tag', function() {
// ...
} );
?>
Filters the HTML attributes applied to a menu item's anchor element.
-
array
$attrs
Array of attributes to be added to the navigation<a>
tag. -
WP_Post
$item
Menu item data object. -
stdClass
$args
An object ofwp_nav_menu()
arguments. -
integer
$depth
Depth 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
$allowed
Array 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
$apply
Whether 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
async
to.
<?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
$disable
Whether to disable emojis.
<?php add_filter( 'benenson_disable_emoji' '__return_true' ); ?>