1. Documentation
  2. Developer
  3. Using hooks

Using hooks

Hooks in WordPress themes serve as crucial entry points for developers to customize and enhance functionality. While WordPress core provides some action hooks and template tags, they might not cover all necessary use cases. Hooks enable dynamic content and modifications within the theme. Let’s delve into the essential hooks provided by our themes:

1. HTML <html> Hook

keydesign_html_before

This hook allows you to inject content before the <html> tag.

2. HTML <head> Hooks

keydesign_head_top
keydesign_head_bottom

These hooks enable you to insert content at the top or bottom of the <head> section, respectively.

3. HTML <body> Hooks

keydesign_body_top
keydesign_body_bottom

These hooks allow you to add content at the beginning or end of the <body> tag.

4. Header Hooks

keydesign_header_before
keydesign_header_after
keydesign_header_top
keydesign_header_bottom
keydesign_header
keydesign_page_header_before
keydesign_page_header_after
keydesign_page_header_top
keydesign_page_header_bottom
keydesign_page_header_content

These hooks offer customization options for different parts of the site and page header, both before and after specific elements.

5. Content Hooks

keydesign_content_before
keydesign_content_after
keydesign_content_top
keydesign_content_bottom
keydesign_content_primary_top
keydesign_content_primary_bottom
keydesign_content_while_before
keydesign_content_while_after
keydesign_content_page
keydesign_content_single
keydesign_content_loop
keydesign_content_404_page

These hooks allow you to customize the content area, including single posts, pages, loops, and error pages.

6. Entry Hooks

keydesign_entry_before
keydesign_entry_after
keydesign_entry_content_before
keydesign_entry_content_after
keydesign_entry_top
keydesign_entry_bottom
keydesign_entry_wrapper_top
keydesign_entry_wrapper_bottom
keydesign_entry_content_card
keydesign_single_entry_content_top
keydesign_single_entry_content_bottom

These hooks provide flexibility around individual entries and their content.

7. Comments Block Hooks

keydesign_comments_before
keydesign_comments_after

These hooks allow customization before and after the comments section.

8. Sidebar Hooks

keydesign_sidebars_before
keydesign_sidebars_after

These hooks enable the customization of sidebars and widget areas.

keydesign_related_content_before
keydesign_related_content_after
keydesign_related_content_top
keydesign_related_content_bottom

These hooks offer options for customizing related posts or content sections.

keydesign_footer_before
keydesign_footer_after
keydesign_footer_top
keydesign_footer_bottom

These hooks enable the modification of different parts of the footer area.

Utilize these hooks to integrate additional features and content into your WordPress theme, enhancing your website’s functionality and user experience. Happy coding!

Was this article helpful?