Developer

Using hooks

Estimated reading: 2 minutes 22 views

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

siteflex_html_before

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

2. HTML <head> Hooks

siteflex_head_top
siteflex_head_bottom

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

3. HTML <body> Hooks

siteflex_body_top
siteflex_body_bottom

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

4. Header Hooks

siteflex_header_before
siteflex_header_after
siteflex_header_top
siteflex_header_bottom
siteflex_header
siteflex_page_header_before
siteflex_page_header_after
siteflex_page_header_top
siteflex_page_header_bottom
siteflex_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

siteflex_content_before
siteflex_content_after
siteflex_content_top
siteflex_content_bottom
siteflex_content_primary_top
siteflex_content_primary_bottom
siteflex_content_while_before
siteflex_content_while_after
siteflex_content_page
siteflex_content_single
siteflex_content_loop
siteflex_content_404_page

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

6. Entry Hooks

siteflex_entry_before
siteflex_entry_after
siteflex_entry_content_before
siteflex_entry_content_after
siteflex_entry_top
siteflex_entry_bottom
siteflex_entry_wrapper_top
siteflex_entry_wrapper_bottom
siteflex_entry_content_card
siteflex_single_entry_content_top
siteflex_single_entry_content_bottom

These hooks provide flexibility around individual entries and their content.

7. Comments Block Hooks

siteflex_comments_before
siteflex_comments_after

These hooks allow customization before and after the comments section.

8. Sidebar Hooks

siteflex_sidebars_before
siteflex_sidebars_after

These hooks enable the customization of sidebars and widget areas.

siteflex_related_content_before
siteflex_related_content_after
siteflex_related_content_top
siteflex_related_content_bottom

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

siteflex_footer_before
siteflex_footer_after
siteflex_footer_top
siteflex_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!

Share this Doc

Using hooks

Or copy link

CONTENTS