We are loving the Kadence theme lately — and these hooks are rarely used. It is so easy to use the drag and drop builder – as it should be. On occasion, though, we have to customize a few things for a client. If you’re new, try the basics on using Kadence and the Block Editor.

Below, you’ll find hooks, filters, and snippets we use in client projects. These are a bit advanced and intended for devs. If you’re unsure, please reach out — our support packages are right here.

Disclaimer: These snippets are for devs who are comfortable with custom code and understand the importance of security. Proceed with caution — and on a staging site.

First, What Are Hooks?

Think of hooks as placeholders in WordPress where you can insert your own code — without editing theme files directly. hooks are comprised of two types: Actions and Filters.

  • Actions let you add custom code at a specific spot.
  • Filters let you modify existing output.

Kadence themes and blocks are full of helpful hooks. Below are the ones we use regularly.

Why We Use Code Snippets (Plugin)

Back in the day (Genesis Framework days), we used a hand-written Core Plugin for every site. Now? We prefer the Code Snippets plugin. Here’s why:

  1. No plugin maintenance!
  2. Rolls back automatically if there’s an error (no white screen of death!).
  3. Lets us load snippets only where needed — great for performance.

Keeping functions separate from your theme is best practice as a WordPress dev, but it is also in the best interests of your clients. Core plugins require constant maintenance – and it takes a budget from your client to do so.

Guiding Principles for Our Custom Code

Custom code can be done so wrong. We are commonly sought out after bad experiences with other developers… even great developers (the real c++ kind of coders) who will completely wreck WordPress. WordPress is a special beast and requires a developer who is willing to preserve it’s extensibility and security. And not everyone will!

When writing code, always always:

  • Maintain Kadence features as-is whenever possible (use hooks, do not overwrite)
  • Performance-aware snippets (not a SQL guru though – see a pro for heavy-duty queries)
  • Respecting accessibility, translation, and security baked into Kadence
  • Lean, clean code — because less is more.

NOTE: the kadencewp theme is perfect for new developers and designers. Use the Kadence Pro Blocks and Kadence Pro theme for the most flexibility, security and longevity. Only customize if you also have the ability to keep your code secure.

Original sources:

  • Trac: (Kadence theme): https://themes.trac.wordpress.org/browser/kadence
  • Git: (Kadence Blocks): https://github.com/kadencewp/kadence-blocks/blob/master/includes/blocks

We often end up creating functions that assist user experience and content architecture and in the examples below, search engine optimization. We use these very sparingly as they require upgrades and ongoing maintenance. So it isn’t fair to use Kadence Hooks for Blocks if the client doesn’t have the budget for maintenance.

Kadence Infobox Block

Goal: Swap out the default <h3> tag in the Infobox block for a <div> or <span> — handy for SEO or semantic markup.

How
WP built-in render_block filter

Example
Add a custom class to the Infobox block (like h3todiv).
Drop this snippet in:

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 );

Post Block Hooks

If you’re customizing the Post Grid block, these hooks are your best friends. See full reference below these examples.

Adjust the Query

Goal
Show different posts in archives and blocks

How
Use kadence_blocks_posts_query_args to change which posts are shown. All args are found here.

kadence_blocks_posts_query_start

Example

add_filter( 'kadence_blocks_posts_query_args', function( $args ) {
    $args['category_name'] = 'tutorials';
    return $args;
});

Customize Output

Goal
Add a little something within the loop of the Post Block

How

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

Example
This will insert “New!” before the post loop starts on each post in the grid. You’ll want to only use this on a small grid of recent posts.

function wpb_custom_loop_intro() {
  echo '<div class="custom-message">New!</div>';
}
add_action( 'kadence_blocks_post_loop_start', 'wpb_custom_loop_intro', 20 );

Customize Style

Goal
Add a class to each post so we can target different numbers

How
WP filter to post_class is handy to add numbers to post classes in an archive. From Ronald Vanweerd

Example
This adds a postcount-1, postcount-2, etc. class to each post:


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' );

Custom Post Type: Hooks

These are specific situations where we needed to add functionality to a CPT. The Kadence team was very helpful. We owe them all the credit!

POST NAVIGATION
Navigation can be shown or not on posts via the customizer. We needed to show the nav on custom post types too. This will let you do that. Use the filter Kadence_post_layout.

Example Filter in use:

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;
}

AUTHOR BOX

Unfortunately, there is no hook for post layout available, so you must change the code in the file, copy into child theme first obviously. And if possible, find a work around! We convinced client to do without.

Example Workaround:

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() );

Other hooks you might need for your CPT’s:

  • kadence_author_meta_output
  • kadence_pagination_args
    • mid-size
    • prev_text
    • next_text
    • screen_reader_text

Post Block Hooks Reference

Has no effect on posts displayed:
kadence_blocks_posts_before_query

Before loop begins:
kadence_blocks_posts_query_start

Loop:

  • 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)

Kadence Single Template Hooks Reference

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

Kadence Archive Hook Reference

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

Frequently Asked Questions

Can I use this on live sites?

Yes, but test first! One missing semicolon will break the whole thing!

Is Code Snippets safe to use?

Yes — safer than editing functions.php directly. It even has a rollback feature.

Can I remove the author box or pagination?

Yes, you can do this in the customizer for posts and pages. For custom post types use kadence_author_meta_output or kadence_pagination_args filters.

Final Note

This guide will grow over time — we use it to document what we discover while working with Kadence themes and blocks. If you’re trying to get tabs to work in Mega Menu – try this fix. If you’d like us to add or test a specific hook, just get in touch!

Want to learn more WordPress development tips? Subscribe to The Creator’s Edge — it’s where we share the good stuff.

New! Welcome-Email AI Agent

Optin-Welcome Series GPT

Cathy Mitchell

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