Action Hooks Widget Areas

From Graphene Theme Documentation
Jump to: navigation, search
Graphene Theme version: 1.5

This is a powerful feature that lets you easily place virtually any content anywhere in the theme using just the WordPress Widgets interface.

Usage instructions

Say that you want to add some text (or any other HTML elements) at the top of the page, before the slider and the sidebar. Here's what you need to do:

  1. Enable the widget area for the particular action hook that you want, in this case the graphene_before_content-main action hook
  2. Go to WP Admin > Widgets, and you’ll see a new widget area called "Graphene Before Content-main" has been added.
  3. Simply add any widget to that widget area, and it will show up exactly where that action hook is defined in the theme.
Three steps to use the Action Hooks Widget Areas feature

The best method to determine which action hook to use is to take a look at the live Graphene Hooks Map. It's a bit crude since the "hotspots" are auto-generated (it would be too time consuming otherwise), but they should significantly help you determine the locations of the action hooks.

Extending the feature

Out of the box, the widgets you put inside the Action Hooks Widget Areas will be displayed on every page on your website. And by default, any PHP codes that you insert in the Text Widget will not be parsed. In order to have more granular control on which page the widget should appear, and use PHP code in widgets, you can extend the theme's functionality by installing the Widget Logic and PHP Code Widget plugins.

Additional resources