The custom action hooks can be used to output content or perform actions at specific parts of the theme.
You can use the Hook name in from the table below with the WordPress function add_action. This is an advanced topic, if you are unsure consult a developer. See the examples below the table.
Tag | Description |
---|---|
tcr_body_start | Immediately after the opening <body> tag |
tcr_outside_start | Immediately inside the <div id=”outside” |
tcr_header | The page header section |
tcr_after_header | Immediately inside the <div class=”after-header-wrap” |
tcr_before_content_style | Before the content style wrapper <div class=”content-style” |
tcr_before_content | Before the page content <main id=”content”> |
tcr_after_content | After the page content |
tcr_after_content_style | After the content style wrapper |
tcr_sidebar_start | Before the sidebar |
tcr_sidebar_end | After the sidebar |
tcr_before_footer | Before the footer |
tcr_footer | Inside the footer |
tcr_after_footer | After the footer |
tcr_body_end | Immediately before the closing </body> tag |
tcr_save_post | (Admin only) called when saving the metabox options. The post ID is given as the only parameter. |
Example
Add a subscribe form content after all single posts
1 2 3 4 5 6 7 8 | function my_subscribe_form() { if (is_singular() && get_post_type() == 'post' && function_exists('iphorm')) { echo '<h2>Thanks for reading, why not subscribe for updates?</h2>'; echo iphorm(2); } } add_action('tcr_after_content', 'my_subscribe_form'); |
function my_subscribe_form() { if (is_singular() && get_post_type() == 'post' && function_exists('iphorm')) { echo '<h2>Thanks for reading, why not subscribe for updates?</h2>'; echo iphorm(2); } } add_action('tcr_after_content', 'my_subscribe_form');