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
function msk_add_love_product_tab($tabs) { | |
$tabs['love_tab'] = array( | |
'title' => __('Popularity', 'msk'), | |
'priority' => 15, | |
'callback' => 'msk_add_love_product_tab_content' | |
); | |
return $tabs; |
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
function msk_add_love_product_tab_content() { | |
wc_get_template('single-product/tabs/love-product.php'); | |
} |
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
<?php | |
/** | |
* "I absolutely love this product" tab | |
* yourtheme/woocommerce/single-product/tabs/love-product.php | |
* @author Mosaika | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} |
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
function msk_remove_additionalinfo_tab($tabs) { | |
unset($tabs['additional_information']); | |
$tabs['description']['title'] = __('Details', 'msk'); | |
$tabs['reviews']['title'] = __( 'Clients reviews', 'msk' ); | |
$tabs['description']['priority'] = 50; | |
return $tabs; | |
} | |
add_filter('woocommerce_product_tabs', 'msk_remove_additionalinfo_tab', 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
/************************************************************************************************* | |
* On ajoute des champs de test pour se repérer, dans l'onglet Général | |
* Résultat visuel : http://img.saika.li/bWk6 | |
*************************************************************************************************/ | |
function msk_add_test_field_data() { | |
echo '<div style="background:#f8fbca; padding:1em;">'; | |
echo '<h4>Testons les différents types de champs</h4>'; | |
// Champ de type text |
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
/************************************************************************************************* | |
* On ajoute 2 champs (post meta ou custom field) aux produits WC dans l'onglet "Avancé" | |
*************************************************************************************************/ | |
function msk_add_loves_hates_fields_to_product() { | |
woocommerce_wp_text_input( | |
array( | |
'id' => 'loves', | |
'data_type' => 'decimal', | |
'label' => __('Loves', 'msk'), | |
'placeholder' => __('Amount of love', 'msk'), |
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
/************************************************************************************************* | |
* On enregistre les valeurs de LOVES & HATES lorsqu'on enregistre un post | |
*************************************************************************************************/ | |
function msk_save_loves_hates_product_fields($product_id, $post, $update) { | |
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; | |
if ($post->post_type == 'product') { | |
if (isset($_POST['loves'])) { | |
$loves = (int)$_POST['loves']; | |
update_post_meta($product_id, 'loves', $loves); |
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
<?php | |
/** | |
* Single Product Sale Flash | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
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
/** | |
* Remove WC image sizes, useless | |
*/ | |
function msk_wc_remove_image_sizes() { | |
remove_image_size('shop_thumbnail'); | |
remove_image_size('shop_catalog'); | |
remove_image_size('shop_single'); | |
} | |
add_action('init', 'msk_wc_remove_image_sizes', 90); |
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
<?php | |
/* | |
* Usage de la fonction msk_send_mail | |
*/ | |
$destinataire = '[email protected]'; | |
$data = array( | |
'prenom' => 'Bruce', |
OlderNewer