How to add code just below opening body tag in Genesis framework

Did you even open header.php and take a peek? You’ll see genesis_before() called right after the opening <body> tag – follow the white rabbit and you get:

function genesis_before() { do_action('genesis_before'); }

And likewise for the footer. So…

add_action( 'genesis_before', 'im_a_lazy_copy_paster' );
add_action( 'genesis_after',  'im_a_lazy_copy_paster' );

function im_a_lazy_copy_paster() {
    if ( current_filter() == 'genesis_before' )
        echo '<script>party.start();</script>';
    else
        echo '<script>if ( cops.called() ) party.split();</script>';
}

Leave a Comment