Last active
August 29, 2015 14:17
-
-
Save webonaut/042c9644b56958bc8df3 to your computer and use it in GitHub Desktop.
WooCommerce - Unterschiedliche Templates laden je nach Produkt-Kategorie
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
// Beschreibung: Lädt unterschiedliche Templates, je nach zugeordneter Produkt-Kategorie; | |
// Speicherort: single-product.php | |
// Quelle: http://pastebin.com/vHLkP79d | |
// Beispiel: Ist ein Produkt der Kategorie 'custom-1' zugeordnet, wird das Template 'content-custom-1' aufgerufen | |
if ( has_term( 'custom-1', 'product_cat' ) ) { | |
wc_get_template_part( 'content', 'custom-1' ); | |
} elseif ( has_term( 'custom-2', 'product_cat' ) ) { | |
wc_get_template_part( 'content', 'single-product-custom-2' ); | |
} else { | |
wc_get_template_part( 'content', 'single-product' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment