Last active
August 29, 2015 13:56
-
-
Save ffoodd/9320481 to your computer and use it in GitHub Desktop.
Inclure un template différent selon la taxonomie ou le terme affiché
This file contains 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
<?php | |
/* == @section Chargement du bon template pour les sous-filtres ==================== | |
/** | |
* @note On charge le même template pour tous les termes de la taxonomie « filtres », à l’exception d’un terme. | |
* @note Merci à Julio Potier et Willy Bahuaud pour l’astuce | |
* @see https://twitter.com/BoiteAWeb | |
* @see https://twitter.com/willybahuaud | |
* @author Gaël Poupard | |
* @see https://twitter.com/ffoodd_fr | |
* @see http://codex.wordpress.org/Plugin_API/Filter_Reference/template_include | |
* @see http://markjaquith.wordpress.com/2014/02/19/template_redirect-is-not-for-loading-templates/ | |
*/ | |
add_filter( 'template_include', 'ffeeeedd_template' ); | |
function ffeeeedd_template( $template ) { | |
if ( is_tax( 'filtres' ) && !is_tax( 'filtres', 'premier-filtre' ) ) { | |
return STYLESHEETPATH . '/taxonomy-filtres.php'; | |
} else { | |
return $template; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment