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( 'woocommerce_product_add_to_cart_url', 'elftoy_fix_for_individual_products', 10, 2 ); | |
function elftoy_fix_for_individual_products( $add_to_cart_url, $product ){ | |
if( $product->get_sold_individually() // if individual product | |
&& WC()->cart->find_product_in_cart( WC()->cart->generate_cart_id( $product->id ) ) // if in the cart | |
&& $product->is_purchasable() // we also need these two conditions | |
&& $product->is_in_stock() ) { | |
$add_to_cart_url = wc_get_checkout_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
function add_security_question_fields() { | |
$num1=rand(1,9); | |
$num2=rand(2,9); | |
echo "<p><label for='math' class='small'>Captcha:$num1 + $num2 = ? </label><input type='text' name='sum' class='input' value='' size='25'>" | |
."<input type='hidden' name='num1' value='$num1'>" | |
."<input type='hidden' name='num2' value='$num2'></p>";} | |
add_action('register_form','add_security_question_fields'); | |
add_action( 'register_post', 'add_security_question_validate', 10, 3 ); | |
function add_security_question_validate( $sanitized_user_login, $user_email, $errors){ |
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
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 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_filter( 'plugins_auto_update_enabled', '__return_false' ); | |
add_filter( 'themes_auto_update_enabled', '__return_false' ); | |
define( 'automatic_updater_disabled', true ); | |
define( 'wp_auto_update_core', false ); |
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 webp_is_displayable($result, $path) { | |
if ($result === false) { | |
$displayable_image_types = array( IMAGETYPE_WEBP ); | |
$info = @getimagesize( $path ); | |
if (empty($info)) { | |
$result = false; | |
} elseif (!in_array($info[2], $displayable_image_types)) { | |
$result = false; | |
} else { |
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( 'login_url', 'Custom_use_woocommerce_login_page' ); | |
/** | |
* If WooCommerce is active use the account page for logging in | |
* @param string $login_url The URL for login. | |
* @param string $redirect The URL to redirect back to upon successful login. | |
* @param bool $force_reauth | |
* @return string |
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( 'get_the_archive_title', 'my_theme_archive_title' ); | |
/** | |
* Remove archive labels. | |
* | |
* @param string $title Current archive title to be displayed. | |
* @return string Modified archive title to be displayed. | |
*/ | |
function my_theme_archive_title( $title ) { | |
if ( is_category() ) { | |
$title = single_cat_title( '', false ); |
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
/** * Completely Remove jQuery From WordPress */ | |
function my_init() { | |
if (!is_admin()) { | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', false); | |
} | |
} | |
add_action('init', 'my_init'); |
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
/** * Install latest jQuery version 3.4.1. */ | |
if (!is_admin()) { | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"), false); | |
wp_enqueue_script('jquery'); | |
} |
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
/** * Completely Remove jQuery From WordPress Admin Dashboard */ | |
add_action('wp_enqueue_scripts', 'no_more_jquery'); | |
function no_more_jquery(){ | |
wp_deregister_script('jquery'); | |
} |