Created
June 8, 2015 14:09
-
-
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 )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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