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_action( 'woocommerce_before_calculate_totals', 'naj_apply_conditionally_taxes', 20, 1 ); | |
function naj_apply_conditionally_taxes( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
return; | |
} |
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 | |
/* | |
* These two techniques add a query var with the modified filetime of the CSS file | |
* | |
* It works great for cache-busting at the browser level | |
* It won't help with Cloudflare cache. That one needs to be purged as even with the query var, | |
* it will decide to send the old file contents. | |
* | |
* Of course, if you're using a cache plugin and tell it to discard the query vars, |
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( 'genesis_post_info', 'tj_post_info_filter' ); | |
function tj_post_info_filter( $post_info ) { | |
// we didn't want to "count" condolences, so we hacked it slightly to simply ALWAYS say "Leave your condolences" | |
return '[post_comments zero="Leave your condolences" one="Leave your condolences" more="Leave your condolences"]'; | |
} | |
add_filter( 'comment_form_defaults', 'tj_comment_form_atts' ); | |
function tj_comment_form_atts( $atts ) { |
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 | |
$classes = []; | |
// bunch of code | |
if( some condition) { | |
$classes[] = 'has-thumbs'; | |
} |
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 ($) { | |
VIDTUTE = {}; | |
VIDTUTE.Utils = { | |
timecodeToSeconds: function (strTimecode) { | |
arrTime = strTimecode.split(':'); | |
//console.log(arrTime); |
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 | |
$args = [ | |
'post_type' => [ 'product' ], | |
'post_status' => [ 'published' ], | |
'tax_query' => [ | |
'relation' => 'AND', | |
[ | |
'taxonomy' => 'product_cat', | |
'terms' => '164', | |
'field' => 'term_id', |
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 | |
$my_var = 'Something | |
on multiple | |
lines'; | |
$cleaned_var = str_replace( [ "\r", "\n", chr( 10 ), chr( 13 ) ], '', $my_var ); | |
// comme Oleg dit, juste au cas où tu te bats contre des quotes | |
$cleaned_var = str_replace('"', '"', $cleaned_var); |
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 | |
$subfield['value'] = ( $blank ) ? ("") : ( isset( $args['value'][ $row ][ $subfield['id'] ] )) ? ($args['value'][ $row ][ $subfield['id'] ] ): (""); |
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 | |
/** | |
* Grab a placeholder image from Unsplash | |
* https://source.unsplash.com/ | |
* | |
* @author Michal Bluma | |
* | |
* @param int $width Desired width | |
* @param int $height Desired height |
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 | |
class Get_Words { | |
public static $meta_compiled_words = 'awesome_words_compiled'; | |
public static $repeater_name_left = 'awesome_words_repeater_left'; | |
public static $repeater_name_right = 'awesome_words_repeater_right'; | |
public static $repeater_subfield = 'words'; |
NewerOlder