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 | |
//Don't forget to change the _1 in the hook to the ID of your form | |
add_filter('gform_validation_1', 'iso_min_sum_validate'); | |
// Most code taken from http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_validation%22_Hook | |
function iso_min_sum_validate($validation_result) { | |
// We'll base our loop on CSS class |
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'] ] ): (""); |
NewerOlder