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 | |
/** Disable Ajax Call from WooCommerce on front page, posts, categories, and tags*/ | |
add_action( 'shutdown', 'dequeue_woocommerce_cart_fragments'); | |
function dequeue_woocommerce_cart_fragments() { | |
if (is_front_page() || is_single() || is_category() || is_tag() ) wp_dequeue_script('wc-cart-fragments'); | |
} |
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( 'wp_enqueue_scripts', 'optimize_woocommerce_styles_scripts', 99 ); | |
function optimize_woocommerce_styles_scripts() { | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); | |
if ( function_exists( 'is_woocommerce' ) ) { | |
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { | |
wp_dequeue_style( 'woocommerce_frontend_styles' ); | |
wp_dequeue_style( 'woocommerce_fancybox_styles' ); | |
wp_dequeue_style( 'woocommerce_chosen_styles' ); |
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
<div class="wrapper"> | |
{% for item in current_post.cf_module %} | |
<div class="left-col-img"> | |
<img src="{{item.image_module|raw}}" alt="image alt here"> | |
</div> | |
<div class ="right-col-content"> | |
<h3>{{item.titre_du_module|raw}}</h3> | |
<p>{{item.description_du_module|raw}}</p> |
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 | |
// Mode vacances | |
add_action ('init', 'mode_vacances_boutique'); | |
// Désactiver les fonctionnalités de WC | |
function mode_vacances_boutique() { | |
// Désactiver l'ajout au panier |
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 | |
// Remplacer "Lire la suite" par autre chose | |
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); | |
function custom_woocommerce_product_add_to_cart_text( $text ) { | |
// En utilisant une condition (if) | |
if ( 'Lire la suite' == $text ) { | |
$text = __( 'Commander', 'woocommerce' ); | |
} |
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 | |
/* | |
DISCLAIMER : | |
This script is for BENCHMARK, use at your own risk. | |
DO NOT run this script unless you FULLY understand and know what you are doing. | |
This script will generate random 1M simple products on your WooCommerce (can be modified @line 43) | |
*/ | |
if (php_sapi_name() !== 'cli') { |
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
uname:pwdmd5hash | |
# BEGIN WP AUTH | |
<Files wp-login.php> | |
AuthUserFile /var/www/vhosts/hostname.com/httpdocs/.wpauth | |
AuthName "Authentication" | |
AuthType Basic | |
require valid-user | |
</Files> |
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( 'gettext', 'webplus_translate_woocommerce_strings', 999 ); | |
function webplus_translate_woocommerce_strings( $translated ) { | |
// Store all string in an array | |
$translatedStrings = array( | |
'Sale!' => 'ON OFFER', | |
'Product Description' => 'Product Specifications', | |
); | |
$translated = str_ireplace( array_keys($translatedStrings), $translatedStrings, $translated ); | |
return $translated; | |
} |
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 | |
$id = isset( $_GET['id'] ) ? rtrim( trim( $_GET['id'] ), '/' ) : 'default'; | |
$f = fopen( 'redirects.txt', 'r' ); | |
$urls = array(); | |
// The file didn't open correctly. | |
if ( !$f ) { | |
echo 'Make sure you create your redirects.txt file and that it\'s readable by the redirect script.'; | |
die; |
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 | |
// parse_url renvoie le chemin d'accès de l'URL demandée | |
$request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); | |
// strpos trouve la position de la première occurrence de'/wp-admin/' | |
// et retourne false si la chaîne n'est pas trouvée. | |
// La variable $is_admin stocke la valeur retournée. | |
$is_admin = strpos($request_uri, '/wp-admin/'); |