Bonjour,
alors j'explique mon soucis par défaut woocommerce affiche les catégories dans des balises "<li> " juste avant les produit j'ai donc trouver la fonction qui recueille les catégories et les enfermer dans un div dans la fonction qui ce trouve dans woocommerce>include>wc-template-functions.php la fonction est la suivante:
Et je souhaiterai le modifié comme ca
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 function woocommerce_output_product_categories( $args = array() ) { $args = wp_parse_args( $args, array( 'before' => '', 'after' => '', 'parent_id' => 0, ) ); $product_categories = woocommerce_get_product_subcategories( $args['parent_id'] ); if ( ! $product_categories ) { return false; } echo $args['before']; // WPCS: XSS ok. foreach ( $product_categories as $category ) { wc_get_template( 'content-product_cat.php', array( 'category' => $category, ) ); } echo $args['after']; // WPCS: XSS ok. return true; }
mais je n'y arrive pas quelqu'un pourrait-il m'aidez
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 function storefront_woocommerce_output_product_categories ( $args = array() ) { $args = wp_parse_args( $args, array( 'before' => '', 'after' => '', 'parent_id' => 0, ) ); $product_categories = woocommerce_get_product_subcategories( $args['parent_id'] ); if ( ! $product_categories ) { return false; } echo $args['before']; // WPCS: XSS ok. echo "<div>"; foreach ( $product_categories as $category ) { wc_get_template( 'content-product_cat.php', array( 'category' => $category, ) ); } echo "</div>"; echo $args['after']; // WPCS: XSS ok. return true; }
merci d'avance
Partager