We are loving the kadence theme! These are hooks, filters and snippets that we use. Use these at your own risk. No coding support is provided. We are happy to help if you need – see here for our rates.

This page will grow as we need, and find, hooks for our various Kadence WP Child Theme projects. If you need to know how to use a hook, see this tutorial in WordPress docs. This list is not exhaustive, and this is designed solely for use by developers.

NOTE: the kadencewp theme is perfect for new developers and designers. Use the pro blocks and kadence pro theme for the most flexibility, security and longevity. Only customize with this code, if you also have ability to keep your code secure.

Original sources:

Trac: (theme): https://themes.trac.wordpress.org/browser/kadence

Git: (Blocks): https://github.com/kadencewp/kadence-blocks/blob/master/includes/blocks

On Core Plugins or Code Plugins

When we were developing on the Genesis Framework, we used a child theme and a custom written Core Plugin with each theme. Now we use Code Snippets plugin which has several benefits to creating your own plugin.

  1. We like that there is a code editor online
  2. Automatic rollback when errors happen
  3. provides different scenarios for enqueueing the hooks – this means they do not load on every page if not necessary.

The idea is to keep the functions and styles separate. That has been the goal, in general for all themes since 2007 when I started with WordPress. Keeping the functions separate means the site owner is free to choose any theme they like without risking the loss of a function.

We often end up creating functions that assist user experience and content architecture; and search engine optimization. These snippets and hooks will always:

  1. Keep as much of the Kadence infrastructure as possible – only ‘hooking’ into place when a callback is actually needed
  2. Keep speed in mind (but I am no expert in custom sql queries – if you’re dealing with a busy site, you’ll want these reviewed by an expert)
  3. Keep accessibility, security and translation capabilities that are already built into Kadence
  4. follow the principle that less coding is better / always lean!

Kadence Infobox Block

We used this to change H3 to a ‘span’ or ‘div’ as required. Must use advanced > Custom CSS class

function wpb_change_infobox_title_tag( $block_content, $block ) {
 if ( $block['blockName'] === 'kadence/infobox' ) {
      //add your class name
     //use h3 in your block
   if ( ( strpos($block['attrs']['className'], 'h3todiv') !== false ) ) {
     $block_content = str_replace( array('<h3', '/h3>'), array('<div', '/div>'), $block_content);
   }
 }
 return $block_content;
}
add_filter( 'render_block', 'wpb_change_infobox_title_tag', 10, 2 );

Kadence Post Grid Block

Filter your own queries: kadence_blocks_posts_query_args (args are here)

Edit the display. (entry template for v. 1.1.31)

Has no effect on posts displayed:
kadence_blocks_posts_before_query

before loop begins:
kadence_blocks_posts_query_start

  • kadence_blocks_post_loop_start, 20
  • kadence_blocks_post_loop_header, 10
  • kadence_blocks_post_loop_content
  • kadence_blocks_post_loop_footer_end

After-query, effects the loop:
kadence_blocks_posts_query_end

After query, no effect:
kadence_blocks_posts_after_query

What to do with empty query results:
kadence_blocks_posts_empty_query (default here)

add_action( 'kadence_blocks_post_loop_start', 'wpb_custom_function', 21);

kadence_blocks_post_loop_header

function wpb_custom_function() { 
   echo 'something here'; 
} 
add_action( 'kadence_blocks_post_loop_header', 'wpb_custom_function', 19);

Block Filter

  • kadence_blocks_posts_container_classes
  • kadence_blocks_posts_query_args

Single

kadence_before_main_content

  • kadence_single_after_featured_image
  • kadence_single_before_entry_title
  • kadence_single_after_entry_title
  • kadence_single_before_entry_content
    • kadence_single_content
      • kadence_single_before_entry_header
        • Kadence_entry_header, 10
      • kadence_single_after_entry_header
  • kadence_single_after_entry_content
  • kadence_before_entry_meta
  • kadence_after_entry_meta

kadence_after_main_content

Archives

Archive Header:

  • kadence_archive_before_entry_header
  • kadence_entry_archive_header
  • kadence_archive_after_entry_header

kadence_before_main_content

Begin Loop

kadence_before_loop_entry_meta

  • kadence_loop_entry
    • kadence_loop_after_featured_image
    • kadence_loop_entry_header, 10
      • loop_entry_taxonomies, 10
      • loop_entry_title, 20
      • loop_entry_meta, 30
      • author box:
        • get_the_author
        • get_avatar
        • get_the_author_meta
        • the_author_meta
        • get_the_author_posts_link
  • loop_entry_footer, 30
  • loop_entry_summary, 20

kadence_after_loop_entry_meta

End Loop

kadence_after_main_content

Filters

Add numbered post class on archive

WP filter to post class that is handy to add numbers to post classes in an archive. Allows to add items (ads) between posts on a posts list. From Ronald Vanweerd (source)

function get_post_counter($classes) {
    $post_counter = $GLOBALS['wp_query']->current_post + 1;
    $classes[] .= 'postcount-' . $post_counter;
    return $classes;
}
add_filter('post_class', 'get_post_counter');

Show the post navigation on a Custom post type (filter)

  • filter the post navigation to ‘show’ on CPT using kadence_post_layout:
    • $value[‘navigation’] = ‘show’
add_filter( 'kadence_post_layout', 'wpb_cpt_show_post_navigation', 99 );
//replace books with your cpt slug
function wpb_cpt_show_post_navigation( $value ) {
    if( 'books' === get_post_type() ) { 
	   $value['navigation'] = 'show';
    }
    return $value;
}

Filter the author box to show on CPT

  • not available – must change the code in the file, copy into child theme first obv
if ( 'post' === get_post_type() && kadence()->option( 'post_author_box' ) ) {
	get_template_part( 'template-parts/content/entry_author', get_post_type() );
}
get_template_part( 'template-parts/content/entry_author', get_post_type() );

kadence_author_meta_output

kadence_pagination_args

  • mid-size
  • prev_text
  • next_text
  • screen_reader_text

Beginner Checklist

If you’re starting out, you’ll love our comprehensive 52 point checklist for your website! Read through once, and then work on items one at a time as it comes up!

52 Edits Checklist – beginners categories

Cathy Mitchell

Single Mom, Lifelong Learner, Jesus Follower, Founder and CEO at WPBarista.