List of custom action hooks

The custom action hooks can be used to output content in specific parts of the theme on any specified context (see the Hook contexts page). The syntax of the hook name is:

tcr_{context}_{tag}

You can use any of the tags in the table below for the {tag} part of the hook name, you can find the {context} you want on the Hook contexts page. For more guidance, see the example below the table. You may want to look in header.php and footer.php to see exactly where the hooks are within the source.

TagDescription
headIn the <head> section
body_startImmediately after the opening <body> tag
headerBefore the page header
after_headerAfter the page header
before_content_styleBefore the content style wrapper
before_contentBefore the page content
after_content_styleAfter the content style wrapper
after_contentAfter the page content
sidebar_startBefore the sidebar
sidebar_endAfter the sidebar
before_footerBefore the footer
footerInside the footer
after_footerAfter the footer
body_endImmediately before the closing </body> tag

Example

Add a subscribe form content after all single posts

1
2
3
4
5
6
7
8
9
10
add_action('tcr_singular-post_after_content', 'tcr_add_subscribe_form');
 
function tcr_add_subscribe_form()
{
    if (function_exists('iphorm')) {
        $output = '<h2>Thanks for reading, why not subscribe for updates?</h2>';
        $output .= iphorm(2);
        return $output;
    }
}
add_action('tcr_singular-post_after_content', 'tcr_add_subscribe_form');

function tcr_add_subscribe_form()
{
    if (function_exists('iphorm')) {
        $output = '<h2>Thanks for reading, why not subscribe for updates?</h2>';
        $output .= iphorm(2);
        return $output;
    }
}
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy