Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save subharanjanm/68123d966c3b84f07f66 to your computer and use it in GitHub Desktop.
Save subharanjanm/68123d966c3b84f07f66 to your computer and use it in GitHub Desktop.
Load different template for content as per conditions in Testimonials Widget ( testimonials_widget_get_template_part / tw_get_template_part )
/**
* Load different template for content as per conditions.
*
* @param $templates
* @param $slug
* @param $name
*
* @return mixed
*/
function load_alternate_template( $templates, $slug, $name ) {
if ( $name == 'content' ) {
$name = 'alternate-content';
$templates[0] = $slug . '-' . $name . '.php';
}
return $templates;
}
add_filter( 'testimonials_widget_get_template_part', 'load_alternate_template', 15, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment