Skip to content

Instantly share code, notes, and snippets.

shirokoweb

Block or report user

Report or block shirokoweb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shirokoweb
shirokoweb / functions.php
Created Jul 18, 2019
Mode vacances WooCommerce
View functions.php
<?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
@shirokoweb
shirokoweb / functions.php
Last active Jun 2, 2019
Remplacer des chaînes de texte WooCommerce
View functions.php
<?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' );
}
@shirokoweb
shirokoweb / randomproducts.php
Created May 3, 2019
Random simple product generation for benchmarking
View randomproducts.php
<?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') {
@shirokoweb
shirokoweb / .wpauth
Created Mar 25, 2019
auth wp-admin / login
View .wpauth
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>
View Translate-a-String-in-WooCommerce.php
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;
}
@shirokoweb
shirokoweb / index.php
Created May 28, 2018
hide redirection URLS
View index.php
<?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;
@shirokoweb
shirokoweb / webplus-plugin-filter.php
Created May 7, 2018
Exclure un plugin WordPress de certaines pages
View webplus-plugin-filter.php
<?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/');
@shirokoweb
shirokoweb / Facebook_Chat_GTM.json
Last active May 5, 2018
GTM recipe to fire Facebook Chat including SDK
View Facebook_Chat_GTM.json
{
"exportFormatVersion": 2,
"exportTime": "2018-05-05 17:03:25",
"containerVersion": {
"path": "accounts/2719250224/containers/8610498/versions/0",
"accountId": "2719250224",
"containerId": "8610498",
"containerVersionId": "0",
"container": {
"path": "accounts/2719250224/containers/8610498",
@shirokoweb
shirokoweb / cookiepermission.json
Created Apr 30, 2018
GTM Cookiepermission GDPR
View cookiepermission.json
{
"exportFormatVersion": 2,
"exportTime": "2018-04-30 13:08:19",
"containerVersion": {
"path": "accounts/2719250224/containers/8610498/versions/13",
"accountId": "2719250224",
"containerId": "8610498",
"containerVersionId": "13",
"container": {
"path": "accounts/2719250224/containers/8610498",
@shirokoweb
shirokoweb / showids.php
Created Mar 25, 2018
WP Add column to display IDs
View showids.php
<?php
class Custom_WP_Show_IDs {
public function __construct() {
add_action( 'admin_init', array( $this, 'custom_objects' ) );
add_action( 'admin_head', array( $this, 'add_css' ) );
// For Post Management
You can’t perform that action at this time.