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
/** | |
* WordPress function for redirecting users on login based on user role | |
*/ | |
function awp_login_redirect_callback( $url, $request, $user ) { | |
/* | |
* Add your custom url | |
*/ | |
$url = home_url( '/cart/' ); | |
return $url; |
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
/** | |
* Print custom text on the profile page after the nickname | |
*/ | |
function awp_bp_before_member_header_meta_callback() { | |
echo "Custom Text"; | |
} | |
add_action( 'bp_before_member_header_meta', 'awp_bp_before_member_header_meta_callback' ); |
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
/** | |
* Change the default template to elementor_header_footer for new page and post | |
*/ | |
function bb_rest_set_default_page_template( $data, $post ) { | |
if ( | |
0 != count( get_page_templates( $post ) ) | |
&& get_option( 'page_for_posts' ) != $post->ID | |
&& '' == $data->data['template'] | |
) { |
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 use_block_editor_for_post_disable_gutenberg( $can_edit, $post ) { | |
if( $post->ID == '247' ) { | |
return false; | |
} | |
return true; | |
} | |
add_filter( 'use_block_editor_for_post', 'use_block_editor_for_post_disable_gutenberg', 10, 2 ); |
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 bp_member_options_nav_custom_link() { | |
?> | |
<li id="custom-link-li" class="bp-personal-tab"> | |
<a href="/members/admin/invites/" id="custom-link" class=""> | |
<div class="bb-single-nav-item-point">Custom Text</div> | |
</a> | |
</li> | |
<?php | |
} | |
add_action( 'bp_member_options_nav', 'bp_member_options_nav_custom_link', 100 ); //Priority must be higher than 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
/** | |
* 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 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 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 |