• 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

New Genesis 2.0 HTML 5 Loop Hooks & How To Use Them

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 5Old XHTML
genesis_before_entry genesis_before_post
genesis_entry_headergenesis_before_post_title
genesis_entry_headergenesis_post_title
genesis_entry_headergenesis_after_post_title
genesis_entry_headergenesis_before_post_content
genesis_entry_contentgenesis_post_content
genesis_entry_footergenesis_after_post_content
genesis_after_entrygenesis_after_post
Note: You must install Genesis 2.0 and add support for HTML 5 to your child theme before using the new hooks.

List Of All New HTML 5 Loop Hooks

Includes the 3rd parameter for positioning priority.

Old Loop Hooks

XHTML Loop Hooks

New Loop Hooks

html 5 hooks

Note: If HTML5 is not active, the genesis_loop uses the old hooks and XHTML markup.

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.

Basic Functions Using New Hooks

Basic Functions Using Old Hooks

Useful Resources

  • Genesis Visual Hook Map

Action Hooks

Reader Interactions

Comments

  1. Kevin Donnigan says

    August 21, 2014 at 8:05 pm

    Thank you!!! I was trying so hard to figure out genesis_get_comments_template hook. Finally! ๐Ÿ™‚ ๐Ÿ™‚

    Log in to Reply
  2. Chris says

    May 5, 2014 at 6:52 pm

    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

    Log in to Reply
    • Brad Dalton says

      May 5, 2014 at 7:53 pm

      Add this line after the function.

      For pages use:

      if ( is_singular('page') )

      For Posts use:

      if ( is_singular('post') )
      Log in to Reply
      • Chris says

        May 6, 2014 at 4:30 pm

        Brad,

        Thank you!

        Chris

        Log in to Reply
        • Brad Dalton says

          May 6, 2014 at 8:36 pm

          You’re welcome Chris.

          Log in to Reply
  3. Sharon says

    April 6, 2014 at 5:58 pm

    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?

    Log in to Reply
    • Brad Dalton says

      April 7, 2014 at 12:57 am

      You can add a conditional tag after the function in the code.

      You can use either:

      is_single() ) or is_singular('post') )

      Here’s an example http://wpsites.net/web-design/add-same-after-single-post-entry-widget-to-single-pages/

      Log in to Reply
  4. Matteo says

    March 4, 2014 at 10:48 am

    Great tutorial.

    But if I want to add “facebook comments” BEFORE “wordpress comments form” but AFTER Author Box?

    Log in to Reply
    • Brad Dalton says

      March 4, 2014 at 11:12 am

      No problem.

      Change the hook and add a 3rd parameter for positioning priority if needed. Default is 10.

      Log in to Reply
  5. Jeremy Myers says

    February 22, 2014 at 6:31 am

    So if I do have HTML5 enabled, will the old hooks NOT work?

    Log in to Reply
    • Brad Dalton says

      February 22, 2014 at 6:51 am

      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.

      Log in to Reply
  6. karen says

    February 6, 2014 at 2:11 pm

    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

    Log in to Reply
    • Brad Dalton says

      February 6, 2014 at 2:57 pm

      Yes, Simply add

      if ( is_single() ) {

      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

      Log in to Reply
    • Brad Dalton says

      February 6, 2014 at 4:19 pm

      Karen. If you can provide your code i’ll add it for you and test it.

      Log in to Reply
  7. Blenda says

    January 15, 2014 at 3:49 pm

    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 ๐Ÿ™‚

    Log in to Reply
    • Brad Dalton says

      January 15, 2014 at 11:41 pm

      Hello Brenda

      Yes, i do need a search box. Thanks for the feedback.

      Log in to Reply
  8. Arafin Shaon says

    October 5, 2013 at 9:17 am

    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:

    //** YOAST BREADCRUMBS
    function yoast_crumbs()	{
    	if (is_single())	{
    		if ( function_exists('yoast_breadcrumb') ) {
    			yoast_breadcrumb('','');
    		}
    	}
    }
    add_action('genesis_before_loop', 'yoast_crumbs');
    remove_action('genesis_before_loop', 'genesis_do_breadcrumbs');
    Log in to Reply
    • Brad Dalton says

      October 5, 2013 at 9:26 am

      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.

      Log in to Reply
      • Brad says

        January 29, 2014 at 6:35 pm

        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?

        Log in to Reply
        • Brad Dalton says

          January 29, 2014 at 6:42 pm

          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.

          Log in to Reply
  9. Keith Davis says

    June 5, 2013 at 4:39 pm

    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.

    Log in to Reply
    • Brad Dalton says

      June 5, 2013 at 4:44 pm

      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.

      Log in to Reply
      • Keith Davis says

        June 5, 2013 at 4:50 pm

        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.

        Log in to Reply
        • Brad Dalton says

          June 5, 2013 at 4:56 pm

          Its not difficult to change over. Just a matter of changing the classes.

          Log in to Reply
      • Mathew Porter says

        June 7, 2013 at 4:36 pm

        Other factors may have increased traffic, especially since Google Penguin 2.0 was released last week.

        Log in to Reply
        • Brad Dalton says

          June 7, 2013 at 4:39 pm

          Could well be the reason Mathew.

          Thanks for the feedback.

          Log in to Reply
  10. Carrie Dils says

    June 5, 2013 at 1:04 pm

    Keep the good stuff coming! ๐Ÿ™‚

    Log in to Reply
    • Brad Dalton says

      June 5, 2013 at 1:06 pm

      hahaha!

      Like your table Carrie. Great link bait!!

      Log in to Reply

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.