Guten Theme Hooks

We’ve added a bunch of WordPress hooks to make it easier for you or your developer to easily further customize the Guten theme and add in your own custom code.

If you need a better understanding of how to use these hooks then please refer to the WordPress Plugin API Codex on WordPress.org.

 

It’s advised to create a child theme or use one of our Guten child themes when adding custom code via a hook.

To add code to one of the Guten theme hooks you can simply copy and paste the following code into your functions file of your child theme.

/**
 * My Custom Function
 */
function my_custom_code_function() {
    echo 'Your code goes here';
}
add_filter( 'guten_hook_before_topbar', 'my_custom_code_function' );

 

Or if another plugin has provided you with a shortcode that you want to add into one of the Guten hooks:

/**
 * My Custom Function adding another plugins shortcode
 */
function my_custom_code_function() {
    echo do_shortcode( sanitize_text_field( '[given_shortcode id="4"]' ) );
}
add_filter( 'guten_hook_before_topbar', 'my_custom_code_function' );

 

Then, in the add_filter section, you will replace the first value with one of the hook names provided below.

add_filter( 'guten_hook_before_topbar', 'my_custom_code_function' );

 

Guten Theme – Header hooks available:

 

Before Top Bar Hook:

<?php do_action ( 'guten_hook_before_topbar' ); ?>

This hook sits right at the top of the website and will insert the code before the header top bar.

 


 

After Top Bar Hook:

<?php do_action ( 'guten_hook_after_topbar' ); ?>

This hook will sit in between the header and the top bar so you can add code there if you need to.

 


 

After Header Hook:

<?php do_action ( 'guten_hook_after_header' ); ?>

This hook sits after the theme header.

This hook is not available in the Transparent Header or the Transparent Header Centered as it is the same as using the guten_hook_after_topbar in those header layouts.

 


 

Inside Top Bar Left Hook:

<?php do_action ( 'guten_hook_topbar_left' ); ?>

This hook sits inside the header top bar next to the content on the left.

 


 

Inside Top Bar Right Hook:

<?php do_action ( 'guten_hook_topbar_right' ); ?>

This hook sits inside the header top bar next to the content on the right.

 


 

Guten Theme – Footer hooks available:

 

Before Footer Hook:

<?php do_action ( 'guten_hook_before_footer' ); ?>

This hook sits outside the footer after the content, so just before the footer starts.

 


 

After Footer Before Bottom Bar Hook:

<?php do_action ( 'guten_hook_footer_bottombar_middle' ); ?>

This hook sits in between the footer content and the footer bottom bar.

 


 

After Footer Hook:

<?php do_action ( 'guten_hook_after_footer' ); ?>

This hook sits after the footer, outside of the bottom bar.

 


 

Inside the Bottom Bar Left Hook:

<?php do_action ( 'guten_hook_footer_bottom_left' ); ?>

This hook sits inside the bottom bar of the footer and next to the left content.

 


 

Inside the Bottom Bar Right Hook:

<?php do_action ( 'guten_hook_footer_bottom_right' ); ?>

This hook sits inside the bottom bar of the footer and next to the right content.