Theme hooks allow you to hook into a theme functionality without modifying the core files. Read more about Actions and Filters API here – https://codex.wordpress.org/Plugin_API
How to use Hooks.
In your child theme edit functions.php and add your scripts. Let’s say you want to add something before sidebar, we’ll use xhibiter_sidebar_before hook. The code example would be:
1 2 3 4 |
add_action( 'xhibiter_sidebar_before', 'xhibiter_add_sidebar_message' ); function xhibiter_add_sidebar_message() { echo esc_html__( 'Sidebar Message', 'xhibiter' ); } |
List of available Hooks:
- xhibiter_head_top
- xhibiter_head_bottom
- xhibiter_header_before
- xhibiter_header
- xhibiter_header_after
- xhibiter_masthead
- xhibiter_logo_before
- xhibiter_logo_after
- xhibiter_menu_before
- xhibiter_menu_after
- xhibiter_last_menu_item_after
- xhibiter_body_top
- xhibiter_body_bottom
- xhibiter_primary_content_top
- xhibiter_primary_content_before
- xhibiter_primary_content_query
- xhibiter_primary_content_after
- xhibiter_primary_content_bottom
- xhibiter_comments_before
- xhibiter_comments
- xhibiter_comments_after
- xhibiter_entry_section_before
- xhibiter_content_before
- xhibiter_content_top
- xhibiter_content_bottom
- xhibiter_content_after
- xhibiter_entry_featured_image_before
- xhibiter_entry_featured_image
- xhibiter_entry_featured_image_after
- xhibiter_entry_content_top
- xhibiter_entry_content_bottom
- xhibiter_page_title_before
- xhibiter_page_title_after
- xhibiter_sidebar_before
- xhibiter_sidebar_after
- xhibiter_footer_before
- xhibiter_footer
- xhibiter_footer_after