A simple HOOK question

Community Forums Forums General Discussion A simple HOOK question

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Peter 1 year, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19680

    Joseph Lee
    Participant
    Post count: 136

    I was trying to hook my navigation in the header. I used

    /** Reposition the primary navigation menu */
    remove_action( 'genesis_after_header', 'genesis_do_nav' );
    add_action( 'genesis_header', 'genesis_do_nav' );

    This code drops my nav <div> after all of the header elements. Is there a way to make it drop it at the TOP of the <header>? Is there a way to control where you drop the code in a div?

     

    http://mainstreetelite.com/

    #19704

    Peter
    Participant
    Post count: 76

    If you wanted the nav before the header, you could use;

    [php]/** Reposition the primary navigation menu */
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
    add_action( ‘genesis_before_header’, ‘genesis_do_nav’ );[/php]

    Or if you wanted it in the header itself but before the title ..etc, you could use;

    [php]/** Reposition the primary navigation menu */
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
    add_action( ‘genesis_header’, ‘genesis_do_nav’, 9 );[/php]


    Website: petercoughlin.com
    Twitter: petercoughlin

    #19705

    Joseph Lee
    Participant
    Post count: 136

    So    ,  9 tells the hook where to put it in the hook div? Where is documentation I can read to understand how it works.

     

    Peter, thank you so much for letting me know it was doable. I am REALLY in love with Genesis now.

    #19708

    Joseph Lee
    Participant
    Post count: 136

    Okay, that is called priority. Thanks Peter. I looked it up. I didn’t realize that was one of the par. of hook

    #19710

    Peter
    Participant
    Post count: 76

    Yeah, sort of :-)

    The last number is the priority for the action, which basically dictates when it runs. If it’s got a lower number than other actions, it runs before them. I’m not sure if there is Genesis specific documentation on action priorities, but you can see them if you look through the code.

    You’re welcome!

    Edit: Oops, you beat me to it..


    Website: petercoughlin.com
    Twitter: petercoughlin

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘A simple HOOK question’ is closed to new replies.