Skip to content

Instantly share code, notes, and snippets.

@ffoodd
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ffoodd/9320481 to your computer and use it in GitHub Desktop.
Save ffoodd/9320481 to your computer and use it in GitHub Desktop.
Inclure un template différent selon la taxonomie ou le terme affiché
<?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