-
-
Save About2git/dd19ea3573a4b40244b8 to your computer and use it in GitHub Desktop.
How to echo entry specific Scripts in footer instead of head in Genesis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //* Do NOT include the opening php tag | |
| 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' ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment