• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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.

Action Hooks

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.