Created
November 29, 2021 17:21
-
-
Save nickcernis/35726127cb352233245919dfd46c2914 to your computer and use it in GitHub Desktop.
Prevent footer text escaping 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 | |
// Omit the opening <?php above when adding this to your active theme's functions.php. | |
add_filter( 'genesis_footer_output', 'custom_genesis_do_footer_unmodified' ); | |
/** | |
* Outputs Genesis footer text without calling `wp_kses_post()` | |
* to strip attributes for security purposes. | |
*/ | |
function custom_genesis_do_footer_unmodified() { | |
$footer_text = genesis_get_option( 'footer_text' ); | |
return '<p>' . genesis_strip_p_tags( $footer_text ) . '</p>'; | |
} | |
add_filter( 'genesis_customizer_theme_settings_config', 'custom_genesis_enable_footer_settings' ); | |
/** | |
* Ensures footer text is still available to edit in Genesis site settings. | |
* | |
* @param array $config The settings. | |
* @return array Updated settings with Genesis footer always enabled. | |
*/ | |
function custom_genesis_enable_footer_settings( $config ) { | |
$config['genesis']['sections']['genesis_footer']['active_callback'] = '__return_true'; | |
return $config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment