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: Entfernt die WooCommerce-Produkt-Tabs; nicht zu entfernende Tabs einfach auskommentieren; | |
// Speicherort: functions.php | |
// Quelle: http://docs.woothemes.com/document/editing-product-data-tabs | |
add_filter( 'woocommerce_product_tabs', 'woo_remove_reviews_tab', 98 ); | |
function woo_remove_reviews_tab( $tabs ) { | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab |
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: Ändert die Bezeichnung der WooCommerce-Produkt-Tabs | |
// Speicherort: functions.php | |
// Quelle: http://docs.woothemes.com/document/editing-product-data-tabs | |
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
function woo_rename_tabs( $tabs ) { | |
$tabs['description']['title'] = __( 'Neuer Name 1' ); // Rename the description tab | |
$tabs['reviews']['title'] = __( 'Neuer Name 2' ); // Rename the reviews tab |
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: Erzeugt einen eigenen Action-Hook | |
// Speicherort: functions.php | |
// Quelle: http://relearningtheweb.blogspot.de/2012/12/wordpress-create-custom-action-hook-in.html | |
/* | |
* 1. Create your own custom action hook named 'the_action_hook' | |
* with just a line of code. Yes, it's that simple. | |
* | |
* The first argument to add_action() is your action hook name |
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: Fügt einem Theme WooCommerce-Unterstützung hinzu; | |
// Speicherort: functions.php | |
// Quelle: http://docs.woothemes.com/document/third-party-custom-theme-compatibility | |
add_action( 'after_setup_theme', 'woocommerce_support' ); | |
function woocommerce_support() { | |
add_theme_support( 'woocommerce' ); | |
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: Entfernt die Standard-WC-Contentwrappers und fügt eigene Wrappers hinzu; | |
// Speicherort: functions.php | |
// Quelle: http://docs.woothemes.com/document/third-party-custom-theme-compatibility | |
// Removing WC-Wrappers | |
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); | |
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); | |
// Add Own Wrappers | |
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10); |
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 { |
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: Gibt Term-Infos des aufgerufenen Produktes aus; | |
// Speicherort: in irgendeinem Template, z.B. single-product.php | |
// Quelle: http://pastebin.com/vHLkP79d | |
<?php print_r( get_the_terms( $product->id, 'product_cat' ) ); ?> |
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: Prüft Zuordnung zu einer bestimmten Produktkategorie und gibt die entsprechende Produkt-Kategoriebeschreibung aus | |
// Speicherort: In einem Template, z.B. in der content-single-product.php | |
// Quelle: Wordpress-Codex | |
// Beispiel: Folgender Code prüft, ob ein Produkt der Produkt-Kategorie 'reiseziel-1' oder 'reiseziel-2' zugroednet ist und gibt dann die | |
// entsprechende Produk-Kategoriebeschreibung aus; 20 ist die ID der Kategorie 'reiseziel-1' und 21 ist die ID der Kategorie 'reiseziel-2' | |
// Für 'reiseziel-2' wurde beispielhaft Html und eine CSS-Klasse mit eingefügt (Zeile 11); | |
<?php if( has_term( 'reiseziel-1', 'product_cat' ) ) { | |
echo term_description('20','product_cat'); } | |
elseif ( has_term( 'reiseziel-2', 'product_cat' ) ) { |
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: Prüft Zuordnung zu einer bestimmten Eltern-Produktkategorie und gibt die Kategoriebeschreibung der zugeordneten Kind-Kategorie aus | |
// Speicherort: In einem Template, z.B. in der content-single-product.php | |
// Quelle: http://wordpress.stackexchange.com/questions/178687/output-single-post-custom-taxonomy-child-terms | |
// Beispiel: Folgender Code ermittelt für ein Produkt die zugeordneten Child-Terms des Terms mit der ID 17 der Taxonomy 'product_cat' | |
// und gibt deren Term-description aus | |
// Produkt-Kategorie Reiseziele (ID = 17), Unterkategorie Italien --> Ist ein Produkt der Kategorie Italien zugeordnet, dann wir die Beschreibung | |
// von Italien ausgegeben | |
<?php | |
$child_terms = get_term_children(17, 'product_cat'); |
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 alles Infos des aktuellen abgefragten Objekts und zeigt sie an; | |
// Speicherort: in irgendeinem Template; | |
// Quelle: http://codex.wordpress.org/Function_Reference/get_queried_object | |
<?php | |
$queried_object = get_queried_object(); | |
var_dump( $queried_object ); | |
?> | |
// Alternative: einzelne Werte des queried objects ausgeben: |
OlderNewer