Skip to content

Instantly share code, notes, and snippets.

View footer-scripts.php
View cpt.conf
### Begin Custom Post Type UI Debug Info ###
Multisite: No
SITE_URL: https://xxx.tld
HOME_URL: https://xxx.tld
WordPress Version: 5.4
Permalink Structure: /index.php/%year%/%monthnum%/%day%/%postname%/
View LSWP_cfg.data
eyJsaXRlc3BlZWQtY2FjaGUtY29uZiI6eyJ2ZXJzaW9uIjoiMi45LjkuMiIsInJhZGlvX3NlbGVjdCI6MSwiYXV0b191cGdyYWRlIjpmYWxzZSwibmV3cyI6ZmFsc2UsInB1cmdlX3VwZ3JhZGUiOnRydWUsImNhY2hlX3ByaXYiOmZhbHNlLCJjYWNoZV9jb21tZW50ZXIiOnRydWUsImNhY2hlX3Jlc3QiOnRydWUsImNhY2hlX3BhZ2VfbG9naW4iOnRydWUsInRpbWVkX3VybHMiOiIiLCJ0aW1lZF91cmxzX3RpbWUiOiIiLCJjYWNoZV9mYXZpY29uIjp0cnVlLCJjYWNoZV9yZXNvdXJjZXMiOnRydWUsIm1vYmlsZXZpZXdfZW5hYmxlZCI6ZmFsc2UsIm1vYmlsZXZpZXdfcnVsZXMiOiJNb2JpbGV8QW5kcm9pZHxTaWxrXC98S2luZGxlfEJsYWNrQmVycnl8T3BlcmFcXCBNaW5pfE9wZXJhXFwgTW9iaSIsImNhY2hlX29iamVjdCI6dHJ1ZSwiY2FjaGVfb2JqZWN0X2tpbmQiOnRydWUsImNhY2hlX29iamVjdF9ob3N0IjoiMTI3LjAuMC4xIiwiY2FjaGVfb2JqZWN0X3BvcnQiOiI2Mzc5IiwiY2FjaGVfb2JqZWN0X2xpZmUiOiIzNjAiLCJjYWNoZV9vYmplY3RfcGVyc2lzdGVudCI6dHJ1ZSwiY2FjaGVfb2JqZWN0X2FkbWluIjp0cnVlLCJjYWNoZV9vYmplY3RfdHJhbnNpZW50cyI6dHJ1ZSwiY2FjaGVfb2JqZWN0X2RiX2lkIjoiMCIsImNhY2hlX29iamVjdF91c2VyIjoiIiwiY2FjaGVfb2JqZWN0X3Bzd2QiOiIiLCJjYWNoZV9icm93c2VyIjp0cnVlLCJjYWNoZV9icm93c2VyX3R0bCI6MjU5MjAwMCwibG9naW5fY29va2llIjoiIiwiY2hlY2tfYWR2YW5jZWRj
@shirokoweb
shirokoweb / instockproducts.php
Last active Feb 23, 2020
Affiche uniquement les produits en stock WooCommerce (la case masquer les produits hors stock doit être décochée)
View instockproducts.php
<?php
/**
* @snippet Shortcode pour exclure les produits hors stock - WooCommerce
* @author-url https://webplus.agency
* @author Agence WebPlus
* @compatible WooCommerce 3.8
* @usage [in_stock_products]
* @wc-shortcodes https://github.com/woocommerce/woocommerce/blob/dc7aa3069466f1b7e23fd7ef468760a6a9ddd241/includes/class-wc-shortcodes.php
*/
View opti-plug.php
<?php
/**
* @snippet Conditional plugin load.
* @author Agence WebPlus
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
@shirokoweb
shirokoweb / tac.php
Last active Apr 10, 2021
MU-USE tarteauciron.js
View tac.php
<?php
// securiser l'accès au fichier
if ( ! defined( 'ABSPATH' ) ) exit;
// Chargement TAC
add_action( 'wp_enqueue_scripts', 'webplus_tac_load' );
function webplus_tac_load() {
wp_enqueue_script( 'tarteaucitron', 'https://cdn.jsdelivr.net/gh/AmauriC/tarteaucitron.js@1.3/tarteaucitron.min.js' );
View functions.php
<?php
/** Disable Ajax Call from WooCommerce on front page and posts*/
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() {
if (is_front_page() || is_single() ) wp_dequeue_script('wc-cart-fragments');
}
@shirokoweb
shirokoweb / functions.php
Created Nov 30, 2019
WordPress shutdown hook to disable WooCommerce get_refreshed_fragments
View functions.php
<?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');
}
@shirokoweb
shirokoweb / functions.php
Created Nov 30, 2019
Remove WooCommerce resources where it's not needed
View functions.php
<?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' );
@shirokoweb
shirokoweb / widget.html
Created Nov 30, 2019
Unlimited Elements - Edit Widget - ACF repeater
View widget.html
<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>