Genesis 2.0 Hooks Reference

Your Guide to Genesis Hooks (version 2.0+)

Author’s note: Even though this is an older post, the information is still accurate. I’ve also published a full reference list of Genesis action and filter hooks you may find useful.

Genesis Framework for WordPressGenesis Framework 2.0 marked some big changes for this WordPress framework, most notably the update from XHTML the more SEO-friendly HTML5. As part of this change, quite a few Genesis hooks were updated as well.

There are already some great posts out highlighting these differences and giving instruction for conversion, like Nick Croft’s post explaining Genesis 2.0, and Brad Dalton’s how-to for converting your theme to HTML5. These are great resources if you’re looking to migrate an older Genesis site to version 2.0+.

What I’d like to do here is a hooks comparison chart for pre-HTML5 hooks vs new HTML5 hooks.

Genesis Hooks Reference

The following is a list of Genesis hooks that changed in v2.0. Please note upgrading to Genesis 2.0 will not break old hooks. In order to take advantage of HTML5 on an pre-2.0 theme, you’ll have to enable HTML5 on purpose. 🙂

The hook changes below are correct, but in order to use them properly, some require the use of priorities*. When in doubt, check the StudioPress code snippet library.
Pre-HTML5 Hook Location
New HTML5 Hook Location
genesis_before_post
genesis_before_entry
genesis_before_post_title
genesis_entry_header
genesis_post_title
genesis_entry_header
genesis_after_post_title
genesis_entry_header
genesis_before_post_content
genesis_entry_header
genesis_post_content
genesis_entry_content
genesis_after_post_content
genesis_entry_footer
genesis_after_post
genesis_after_entry

* According to the WordPress Codex, A priority is an optional integer argument used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order added to the action.

Example

In older Genesis themes not enabled for HTML5, you would remove the post info using this hook:

remove_action( 'genesis_before_post_content', 'genesis_post_info' );

With Genesis 2.0 or themes enabled for HTML5, you’d need to change you that hook location to:

remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );

Therefore genesis_before_post_content should be replaced with genesis_entry_header moving forward.

In Summary

The source code for Genesis 2.0 (and earlier versions, too!) is beautifully documented, so I highly recommend opening up Genesis Framework source files and doing a little light reading. It sounds much more intimidating than it actually is. Just do it.

52 thoughts on “Your Guide to Genesis Hooks (version 2.0+)”

  1. Thanks for this post, Carrie. Being new to Genesis, the learning curve was a bit steep but I enjoyed customizing and changing the look and feel of my new blog. This post definitely helped me in customizing my new website.

  2. Hi Carrie

    Thanks for an informative post on the hook side of things. I note that you upgraded Epik manually in around 20-30 minutes, would you be willing to share the Epik changes for the .php files. I have done the CSS but am really not clear on what needs to change in the default php files. I need to do a manual upgrade as its a fully populated site.

    Looking at the loop hook reference none of this are in the Epik files, so I am really at a loss as to where to start.

    Many Thanks

    1. Hi Sally,

      I think you may mean Brad that updated Epik. 🙂 If none of the hooks here are in Epik, you should be good to go where your functions and home page files are concerned. You’ll just need to update your stylesheet from the old selectors to the new.

      Cheers,
      Carrie

      1. Hi Carrie

        Thanks for taking the time to reply. Yes, I had sort of hoped that would be the case but having changed the CSS both manually and automatically and testing- it seems that there are some other php changes required that are outside of the published Genesis hooks.

        Which of course makes them a mystery at the moment 🙂

        I will drop by Brad’s site

        Cheers

  3. We have some code that we use for some clients. It worked fine on non-HTML5 themes. But when using the newer themes that are HTML5 enabled, our code breaks. Here is the before and after code:

    /************ TAKE OUT FOR HTML 5 *********/
    //remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    //remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );

    /************ PUT IN FOR HTML 5 *********/
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’ );
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );

    /************ TAKE OUT FOR HTML 5 *********/
    /*add_action(‘genesis_post_content’, ‘nmd_get_subpages’); ?>*/

    /************ PUT IN FOR HTML 5 *********/
    add_action(‘genesis_entry_content’, ‘nmd_get_subpages’); ?>

    Couldn’t the Genesis developers have put in a bit of logic such that IF the HTML5 switch was set that a call to the “genesis_entry_header” could be executed by “genesis_before_post_content” and same for “genesis_post_content”?

    We had to do quite a bit of debugging to figure out what to change in our module.

    Maybe there is/was a better way to do this on our end? Maybe Genesis has some guidelines for developers that we never saw? (And thank you Ms. Carrie Dils for your post about this. You are a wonderful resource to the community. We’d still be looking for the answer about this without you!)

  4. Pingback: 43 Powerful Blog Marketing WordPress Plugins

Leave a Comment

Your email address will not be published. Required fields are marked *

Carrie Dils uses Accessibility Checker to monitor our website's accessibility.