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 | |
/** | |
* Convert rate (ie. 3.5/5) into fontAwesome stars | |
* | |
* @param int $rate | |
* @return string | |
*/ | |
function getStars($rate){ | |
$max_rate = (int) 5 ; | |
$output = '<div class="widget-rating-stars">'; |
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 | |
/** | |
* @desc CF7 submission tracking. Trigger ga_send (Google Analytics events tracking) when submitting CF7 form. | |
* @return void | |
*/ | |
function trackCf7Submissions() | |
{ | |
?> | |
<script> | |
//get current languages if necessary |
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
jQuery( document ).on( 'updated_checkout', function() { | |
console.log( 'Checkout has been updated...' ); | |
} ); |
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
$('.datepicker').pickadate({ | |
selectMonths: true, // Creates a dropdown to control month | |
selectYears: 2, // Creates a dropdown of 15 years to control year | |
labelMonthNext: 'Mois suivant', | |
labelMonthPrev: 'Mois précédent', | |
labelMonthSelect: 'Selectionner le mois', | |
labelYearSelect: 'Selectionner une année', | |
monthsFull: [ 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre' ], | |
monthsShort: [ 'Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec' ], | |
weekdaysFull: [ 'Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi' ], |
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 | |
add_filter( 'woocommerce_product_dimensions', 'convert_dimensions_into_cm' ,100, 1 ); | |
if(!function_exists('convert_dimensions_into_cm')){ | |
function convert_dimensions_into_cm($dimensions){ | |
//dimensions are set in mm in WC settings, but we want to display cm | |
$dimensions = explode('x', $dimensions) ; | |
$cm = array(); | |
foreach ($dimensions as $elem) { | |
$cm[$elem] = $elem / 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
<?php | |
//prepend "0" to product weight in WooCommerce | |
add_filter( 'woocommerce_product_get_weight', 'prepend_zero' ,100, 1 ); | |
if(!function_exists('prepend_zero')){ | |
function prepend_zero($weight){ | |
//check if first char is a dot "." | |
if (substr($weight, 0, 1) === '.'){ | |
$weight = "0".$weight ; | |
} | |
return $weight ; |
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 | |
// function is shop manager | |
function is_shop_manager() { | |
global $current_user; | |
$user = wp_get_current_user(); | |
if ( isset( $user->roles[0] ) && $user->roles[0] == 'shop_manager' ) { | |
return true; // when user is shop manager | |
} else { | |
return false; // when user is not shop manager |
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
.gmnoprint img, .gm-style img { | |
max-width: none; | |
} |
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 | |
$shipping_items = $order->get_items( 'shipping' ); | |
foreach($shipping_items as $el){ | |
$shipping_method_id = $el['method_id'] ; | |
} | |
?> |