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.
Thank you!!! I was trying so hard to figure out genesis_get_comments_template hook. Finally! 🙂 🙂
Brad,
Thank you for this post. Can you help me with something perhaps simple?
It looks like I can use genesis_before_post_content to create a unique widget area before post titles.
But I also want a unique (and separate) widget area before PAGE titles.
Will genesis_before_post_content end up using the same widget for posts and pages?
Or is there a way to create a separate widget area for pages?
Thank you,
Chris
Add this line after the function.
For pages use:
For Posts use:
Brad,
Thank you!
Chris
You’re welcome Chris.
I have a question. I’m trying to figure out how to stop my email subscription boxes from showing up in my category listings. I wanted it to show up only at the end of entire posts. I used the Genesis Entry Footer Hook. It is showing up in both places. It makes my category section really crowded when someone clicks on a particular category. Can you offer any help?
You can add a conditional tag after the function in the code.
You can use either:
Here’s an example http://wpsites.net/web-design/add-same-after-single-post-entry-widget-to-single-pages/
Great tutorial.
But if I want to add “facebook comments” BEFORE “wordpress comments form” but AFTER Author Box?
No problem.
Change the hook and add a 3rd parameter for positioning priority if needed. Default is 10.
So if I do have HTML5 enabled, will the old hooks NOT work?
Will you be running Genesis 2.0+?
The short answer is no they won’t work if you are running Genesis 2.0 and have added HTML 5 support to your child theme.
The changes only effect the hooks within the loop so you may only need to change 1 or 2 hooks in your functions file.
Thanks for the great tutorial.
I’m trying to add different opt in forms for posts and pages and adding the opt in form on posts using entry hook is also showing up on pages. Is there a way to exclude pages for entry hooks?
Thanks,
Karen
Yes, Simply add
or any other conditionals after the function which hooks in your opt in form. You may also need to add an additional curly bracket at the very end of your code.
You can change the conditional tag if needed. http://codex.wordpress.org/Conditional_Tags
Karen. If you can provide your code i’ll add it for you and test it.
Hello Brad!! I,m subscribe to newsletter of this site and love each update received. I like very much. I would suggest that you put a search box for ease whenever they wish to take any questions come to this site.
sorry any mistake, do not speak English, Portuguese and am just using google translator
Thank you 🙂
Hello Brenda
Yes, i do need a search box. Thanks for the feedback.
Hi sir thanks for your awesome tutorial. I’m using genesis html5 child theme ( genesis sample develop) trying to integrate Yoast breadcrumbs but not being able to integrate it properly. Can you help me regarding this issue ?
Here is the snippet:
Did you already install the plugin?
If you’re using the latest version of WordPress SEO by Yoast, you no longer need to add this code as the breadcrumbs are already included in the plugin.
It still says to add this to your theme’s file, even in the latest version of the plugin.
Where do we add that in Genesis 2.0?
I don’t see why you need to add breadcrumbs when they’re already included in Genesis?
That code is a template tag which you can hook in using a filter, custom function or paste into a template file.
Hi Brad
I’ve seen Carrie’s table and read your previous posts on Gen 2 / HTML5 so I’m slowly getting there.
Since all the old themes are backward compatible with Genesis 2 (if HTML5 is not activated) I’m wondering if people will update or just switch to one of the new themes – be interesting to see how it plays out.
I appreciate that the markup is more meaningful to the bots but other than that I’ve not read anything to make me believe that HTML5 websites will have a big advantage in the SEO stakes.
Are you doing anything which will go a little deeper into SEO benefits – would love to have your thoughts.
Hi Keith
I read an article on Yoast recently which you may find interesting.
I know my traffic has increased recently but its hard to gauge whether that’s from the conversion to HTML 5.
I think there are SEO benefits but at this stage its still not totally clear to me.
Thanks or the comment.
I only run a couple of my own sites, which I may change over, but I doubt if I will contact clients and ask if they would like an update.
Once Studiopress have released a few Gen 2 themes and the SEO benefits of HTML are clearer I may bring up the subject with clients.
Its not difficult to change over. Just a matter of changing the classes.
Other factors may have increased traffic, especially since Google Penguin 2.0 was released last week.
Could well be the reason Mathew.
Thanks for the feedback.
Keep the good stuff coming! 🙂
hahaha!
Like your table Carrie. Great link bait!!