Genesis Hook Before Widget Title

The genesis_before_{$id}_widget_area hook enables you to hook content before the widget title, within the widgets div.

All you need to do is swap out the {$id} in the hook with the i.d from your widget.

Example: If you create a custom widget area using the following code,

genesis_widget_area( 'after-entry' );

You can use the following hook to add content before the after-entry widget title

genesis_before_after-entry_widget_area

The entire code example may look like this using a custom function with add_action:

add_action( 'genesis_before_after-entry_widget_area', 'add_before_widget' );
function add_before_widget() {
echo( 'Hello World' );
}

And here’s the output on the front end using the WordPress calendar widget in the after-entry widget area:

before-widget-title

The following image shows the Hello World text output before the widget title, within the after-entry widgets div class, in the HTML source code.

widget-markup

You can use the genesis_before_{$id}_widget_area to add content before any custom widget area you add to a Genesis child theme or any widget area already added in an existing Genesis child theme.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.