You will need to add HTML 5 support to your Genesis child theme in order to make these new hooks work.
On top of this, the old XHTML markup in existing child themes will need to be converted to HTML 5 as well. Otherwise, you’ll probably find your site is messed up.
Once you’ve done all that, you can then change any existing loop hooks or use the new loop hooks in your child themes functions.php file with custom functions.
Genesis Hook Comparison
New HTML 5 | Old XHTML |
---|---|
genesis_before_entry | genesis_before_post |
genesis_entry_header | 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_content | genesis_post_content |
genesis_entry_footer | genesis_after_post_content |
genesis_after_entry | genesis_after_post |
List Of All New HTML 5 Loop Hooks
Includes the 3rd parameter for positioning priority.
Old Loop Hooks
New Loop Hooks
Lets look at a real code snippet which is tested and works.
Example:
This code will add a widget area after single posts and pages using the new genesis_after_entry_content
hook. That’s the only change in this code.
The code will NOT work unless you have added HTML 5 support to your child theme and activated Genesis 2.0.
Line 8 in this code shows you the new hook.
Simply updating to Genesis 2.0 is not enough to make this code work. The new hooks are dependent on HTML 5 supported child themes.
Old Hook Example
genesis_after_post_content
New Hook Example
genesis_after_entry_content
I’ll be posting more useful code snippets using the new hooks shortly.
Was This Tutorial Helpful?