Skip to content
Site Under Re-Design: We're updating & improving the docs! Some layouts or content may look broken or inconsistent during this process. If you’re unable to find an article, please use the search bar while we restructure and optimize the sidebar navigation.

Alter Any Theme Template Part via Callable Function or Custom File

// Example to override the Top Bar Content
// See Total/framework/template-parts.php for the array of template parts
add_filter( 'wpex_template_parts', function( $parts ) {
	$parts['topbar_content'] = function() {
		echo 'Replace the topbar content with this.';
	};
	return $parts;
} );

// Example to override blog entries for the homepage only
add_filter( 'wpex_template_parts', function( $parts ) {

    // Custom output for homepage blog entries
    if ( is_home() ) {
        $parts['blog_entry'] = function() {
            get_template_part( 'home-entry' ); // Now you can create a file named home-entry.php in your child theme to override the homepage entries
        };
    }

    return $parts;

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Related Snippets
Back To Top