Code placed in Scripts textarea in WordPress editor on Static Pages and single Posts in Genesis gets echoed out or printed in the header i.e., before closing head tag by default.
What if you want the script to be output before the closing body tag instead like this?
Add the following in child theme’s functions.php:
remove_action( 'wp_head', 'genesis_header_scripts' ); | |
add_action( 'wp_head', 'sk_header_scripts' ); | |
/** | |
* Echo header scripts in to wp_head(). | |
* | |
* Allows shortcodes. | |
* | |
* Applies `genesis_header_scripts` filter on value stored in header_scripts setting. | |
* | |
* @since 0.2.3 | |
* | |
* @uses genesis_get_option() Get theme setting value. | |
* @uses genesis_get_custom_field() Echo custom field value. | |
*/ | |
function sk_header_scripts() { | |
echo apply_filters( 'genesis_header_scripts', genesis_get_option( 'header_scripts' ) ); | |
} | |
add_action( 'wp_footer', 'sk_footer_scripts' ); | |
function sk_footer_scripts() { | |
//* If singular, echo scripts from custom field | |
// | |
if ( is_singular() && genesis_get_custom_field( '_genesis_scripts' ) ) { | |
genesis_custom_field( '_genesis_scripts' ); | |
} | |
} |
Source:
wp-content/themes/genesis/lib/structure/header.php
wp-content/themes/genesis/lib/structure/footer.php
https://github.com/wpsmith/arche/blob/master/lib/functions/gs-functions.php