Skip to content

Instantly share code, notes, and snippets.

@fabienlege
fabienlege / woocommerce-elementor.css
Last active February 8, 2022 09:34
Styling Woocommerce "My acount" page with elementor global variables
/* === */
/* Espace client */
/* === */
.woocommerce a.button.alt, .woocommerce a.button,.woocommerce #payment #place_order, .woocommerce-page #payment #place_order{
background: transparent;
border: 2px solid var(--e-global-color-primary);
color: var(--e-global-color-primary);
border-radius: 0;
font-family: var(--e-global-typography-primary-font-family);
@fabienlege
fabienlege / slow_vps.sh
Created May 5, 2021 13:18
Débuggage lors d'un ralentissement serveur
# 1 - Vérifier les performance en temps réel avec htop ou top
top
# 2 - Vérifier l'espace utilisé du disque dur avec df
df -h
# 3 - Vérification des performances passés enregistrés par le serveur
### 3.a - Vérification de l'usage du CPU
### Il faut bien vérifier la colone %idle.
@fabienlege
fabienlege / list_hooks.php
Created June 9, 2020 17:56
Liste tous les hooks (filters et actions) de wordpress (sur la page courante)
<?php
$debug_tags = array();
add_action( 'all', function ( $tag ) {
global $debug_tags;
if ( in_array( $tag, $debug_tags ) ) {
return;
}
echo "<pre>" . $tag . "</pre>";
$debug_tags[] = $tag;
} );
@fabienlege
fabienlege / webserver_install.sh
Last active May 26, 2020 12:26
Install webserver (on ubuntu).
#!/bin/sh
#
# Pour lancer ce script, lancer la commande ci-dessous :
# curl -o- https://gist.githubusercontent.com/fabienlege/5dee0d89df4cdbce6d6a42ca43b9b535/raw/webserver_install.sh | bash
#
echo "
_ _____
| | | ___|
@fabienlege
fabienlege / .htaccess
Created April 22, 2020 19:57
redirect to public dir
RewriteEngine On
RewriteCond %{REQUEST_URI} !^web
RewriteRule ^(.*)$ web/$1 [L]
RewriteBase /
@fabienlege
fabienlege / disable_posts_on_wordpress.php
Last active February 5, 2020 17:45
Completely disable built-in posts in wordpress
<?php
/***
* _ _____
* | | | ___|
* __ _ __ _ ___ _ __ ___ ___ | |__ ___ |___ \
* / _` |/ _` |/ _ \ '_ \ / __/ _ \ | '_ \ / _ \ \ \
* | (_| | (_| | __/ | | | (_| __/ | | | | (_) /\__/ /
* \__,_|\__, |\___|_| |_|\___\___| |_| |_|\___/\____/
* __/ |
* |___/
@fabienlege
fabienlege / format_phone.php
Created October 10, 2019 13:05
EN: Format french phone number with custom wordpress hook (filter) FR : Formater automatiquement un numéro de téléphone pour l'affichage uniforme sur las pages à l'aide d'un filtre wordpress personnalisé.
/***
* _ _____
* | | | ___|
* __ _ __ _ ___ _ __ ___ ___ | |__ ___ |___ \
* / _` |/ _` |/ _ \ '_ \ / __/ _ \ | '_ \ / _ \ \ \
* | (_| | (_| | __/ | | | (_| __/ | | | | (_) /\__/ /
* \__,_|\__, |\___|_| |_|\___\___| |_| |_|\___/\____/
* __/ |
* |___/
*
SELECT id
FROM events
WHERE start >= '2013-07-22' AND end <= '2013-06-13'
@fabienlege
fabienlege / .htaccess
Created May 28, 2018 10:27
Redirect all visitors to https with. Force https apache
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
add_filter( 'nav_menu_meta_box_object', 'show_private_pages_menu_selection' );
/**
* Add query argument for selecting pages to add to a menu
*/
function show_private_pages_menu_selection( $args ){
if( $args->name == 'page' ) {
$args->_default_query['post_status'] = array('publish','private');
}
return $args;
}