This file contains hidden or 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 condition to check if the user is login and non-login | |
* Notes: Make sure to set the login user homepage as the default homepage in the Admin Dashboard -> Settings-> Reading | |
*/ | |
function change_the_homepage_for_non_login_user() { | |
if ( ! is_admin() && ! is_user_logged_in() ) { | |
add_filter( 'pre_option_page_on_front', 'pre_option_page_on_front_homepage_for_non_login_user' ); | |
} | |
} | |
add_action( 'init', 'change_the_homepage_for_non_login_user' ); |
This file contains hidden or 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
Main query run on the live site: | |
Chagne the open to paynow | |
UPDATE wpig_postmeta as pm | |
SET pm.meta_value = 'paynow' | |
WHERE pm.meta_key = '_ld_price_type'; | |
For 300: |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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() | |
); |