Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Last active January 17, 2018 12:42
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 gregoirenoyelle/7b14428924128c479156d07020039746 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/7b14428924128c479156d07020039746 to your computer and use it in GitHub Desktop.
<?php
/*****
* Voir les hook dans les fichiers:
* /woocommerce/includes/wc-template-hooks.php
* Les fonctions sont ajoutées à un fichier dédié dans mon thème qui est appelé depuis le
* le fichier principal: functions.php
*/
// Ajout de texte avant les vignettes
add_action( 'woocommerce_before_shop_loop_item_title', 'gn_contenu_avant_vignette', 5);
function gn_contenu_avant_vignette() {
echo '<div>Avant les vignettes</div>';
}
// Ajout de contenu après les vignettes
add_action( 'woocommerce_shop_loop_item_title', 'gn_contenu_apres_vignette', 5 );
function gn_contenu_apres_vignette() {
echo '<div>Après les vignettes</div>';
}
// Suppression des vignettes. Oui, carrément!
// remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
// Changement de place pour ajouter au panier
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment