* // Declare support for all hook types * add_theme_support( 'tha_hooks', array( 'all' ) ); * * // Declare support for certain hook types only * add_theme_support( 'tha_hooks', array( 'header', 'content', 'footer' ) ); * */ add_theme_support( 'tha_hooks', array( /** * As a Theme developer, use the 'all' parameter, to declare support for all * hook types. * Please make sure you then actually reference all the hooks in this file, * Plugin developers depend on it! */ 'all', /** * 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. */ // 'core' ) ); /** * Determines, whether the specific hook type is actually supported. * * Plugin developers should always check for the support of a specific * hook type before hooking a callback function to a hook of this type. * * Example: * * if ( current_theme_supports( 'tha_hooks', 'header' ) ) * add_action( 'tha_head_top', 'prefix_header_top' ); * * * @param bool $bool true * @param array $args The hook type being checked * @param array $registered All registered hook types * * @return bool */ function tha_current_theme_supports( $bool, $args, $registered ) { return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] ); } add_filter( 'current_theme_supports-tha_hooks', 'tha_current_theme_supports', 10, 3 ); /** * HTML hook * Special case, useful for , etc. * $tha_supports[] = 'html; */ 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_bottom() { do_action( 'tha_body_bottom' ); } /** * HTML hooks * * $tha_supports[] = 'head'; */ function tha_head_top() { do_action( 'tha_head_top' ); } function tha_head_bottom() { do_action( 'tha_head_bottom' ); } /** * Semantic
hooks * * $tha_supports[] = 'header'; */ function tha_header_before() { do_action( 'tha_header_before' ); } function tha_header_after() { do_action( 'tha_header_after' ); } function tha_header_top() { do_action( 'tha_header_top' ); } function tha_header_bottom() { do_action( 'tha_header_bottom' ); } /** * Semantic hooks * * $tha_supports[] = 'content'; */ function tha_content_before() { do_action( 'tha_content_before' ); } function tha_content_after() { do_action( 'tha_content_after' ); } function tha_content_top() { do_action( 'tha_content_top' ); } function tha_content_bottom() { do_action( 'tha_content_bottom' ); } /** * Semantic hooks * * $tha_supports[] = 'entry'; */ function tha_entry_before() { do_action( 'tha_entry_before' ); } function tha_entry_after() { do_action( 'tha_entry_after' ); } function tha_entry_top() { do_action( 'tha_entry_top' ); } function tha_entry_bottom() { do_action( 'tha_entry_bottom' ); } /** * Comments block hooks * * $tha_supports[] = 'comments'; */ function tha_comments_before() { do_action( 'tha_comments_before' ); } function tha_comments_after() { do_action( 'tha_comments_after' ); } /** * Semantic hooks * * $tha_supports[] = 'sidebar'; */ function tha_sidebars_before() { do_action( 'tha_sidebars_before' ); } function tha_sidebars_after() { do_action( 'tha_sidebars_after' ); } function tha_sidebar_top() { do_action( 'tha_sidebar_top' ); } function tha_sidebar_bottom() { do_action( 'tha_sidebar_bottom' ); } /** * Semantic