diff --git a/tha-theme-hooks.php b/tha-theme-hooks.php index fe013aa..4dc62e0 100644 --- a/tha-theme-hooks.php +++ b/tha-theme-hooks.php @@ -18,9 +18,9 @@ * GNU General Public License for more details. */ -/** - * Define the version of THA support, in case that becomes useful down the road. - */ +/** + * Define the version of THA support, in case that becomes useful down the road. + */ define( 'THA_HOOKS_VERSION', '1.0-draft' ); /** @@ -65,7 +65,7 @@ 'sidebar', 'footer', - /** + /** * If/when WordPress Core implements similar methodology, Themes and Plugins * will be able to check whether the version of THA supplied by the theme * supports Core hooks. @@ -101,20 +101,22 @@ function tha_current_theme_supports( $bool, $args, $registered ) { * Special case, useful for , etc. * $tha_supports[] = 'html; */ - function tha_html_before() { - do_action( 'tha_html_before' ); - } +function tha_html_before() { + do_action( 'tha_html_before' ); +} /** * HTML hooks * $tha_supports[] = 'body'; */ - function tha_body_top() { - do_action( 'tha_body_top' ); - } +function tha_body_top() { + do_action( 'tha_body_top' ); +} - function tha_body_bottom() { - do_action( 'tha_body_bottom' ); - } +function tha_body_bottom() { + if ( current_theme_supports( 'tha_hooks', 'body' ) && ! did_action( 'tha_body_bottom' ) ) + do_action( 'tha_body_bottom' ); +} +add_action( 'wp_footer', 'tha_body_bottom', 1 ); /** * HTML hooks @@ -126,8 +128,10 @@ function tha_head_top() { } function tha_head_bottom() { - do_action( 'tha_head_bottom' ); + if ( current_theme_supports( 'tha_hooks', 'body' ) && ! did_action( 'tha_head_bottom' ) ) + do_action( 'tha_head_bottom' ); } +add_action( 'wp_head', 'tha_head_bottom', 1 ); /** * Semantic
hooks