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 gbol_template_redirect_cart_redirect( $permalink ) { | |
$cart_id = wc_get_page_id('cart'); | |
$checkout_id = wc_get_page_id('checkout'); | |
/** | |
* Skip if this is not a cart page | |
*/ | |
if ( $cart_id == $checkout_id ) { | |
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
function find_matching_product_variation( $product ) { | |
$is_default_variation = false; | |
$default_attributes = $product->get_default_attributes(); | |
foreach($product->get_available_variations() as $variation_values ){ | |
foreach($variation_values['attributes'] as $key => $attribute_value ){ | |
$attribute_name = str_replace( 'attribute_', '', $key ); | |
$default_value = $product->get_variation_default_attribute($attribute_name); | |
if( $default_value == $attribute_value ){ | |
$is_default_variation = true; |
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
add_filter('wc_session_expiring', 'so_26545001_filter_session_expiring' ); | |
function so_26545001_filter_session_expiring($seconds) { | |
return 60 * 2; // 2 mints | |
} | |
add_filter('wc_session_expiration', 'so_26545001_filter_session_expired' ); | |
function so_26545001_filter_session_expired($seconds) { | |
return 60 * 3; // 3 mints |
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 to add class when user is login in or not login in | |
*/ | |
function awp_body_class_callback( $classes ) { | |
$class = get_current_user_id() ? 'user-login' : 'user-logout'; | |
return array_merge( $classes, array( $class ) ); | |
} | |
add_filter( 'body_class', 'awp_body_class_callback', 10, 1 ); |
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
/** | |
* Do not allow the user to send the message when they client on the return button | |
*/ | |
function bb_wp_footer_callback() { | |
?> | |
<script type="text/javascript"> | |
$( document ).ready(function() { | |
var el = document.getElementById( "message_content" ); | |
el.addEventListener("keydown", function(event) { | |
if (event.key === "Enter" && ! event.shiftKey ) { |
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
/** | |
* Always save card token for stripe: Save payment information to my account for future purchases. | |
*/ | |
add_filter( 'wc_stripe_force_save_source', '__return_true' ); | |
/** | |
* Filter the HTML of the stripe credit card details | |
*/ | |
function payment_gateway_field_html_stripe_callback( $field_html ) { | |
$field_html = str_ireplace( '<fieldset', 'style=display:none; <fieldset', $field_html ); |
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
/** | |
* Get the value before the save run | |
*/ | |
function carbon_fields_should_save_field_value_callback( $save, $value, $field ) { | |
$fields_id = 'crb_text'; | |
error_log( print_r( carbon_get_theme_option( $fields_id ), true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new1.log' ); | |
error_log( print_r( $value, true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new1.log' ); |
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
/** | |
* Get the responce from the data cms | |
*/ | |
function get_responce_data_cms_get( $url ) { | |
$param = array( | |
'timeout' => 30, | |
'headers' => array() | |
); |
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
https://stackoverflow.com/questions/8538362/how-do-i-move-a-git-repo-from-beanstalk-to-github | |
# In this example, we use an external account named extuser and | |
# a GitHub account named ghuser to transfer repo.git |
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
/** | |
* Call before the Donation Receipt text is display | |
*/ | |
function give_custom_give_payment_receipt_header_before_callback() { | |
add_filter( 'gettext', 'child_give_text_switcher', 10, 3 ); | |
} | |
add_action( 'give_payment_receipt_header_before', 'give_custom_give_payment_receipt_header_before_callback' ); | |