Skip to content

Instantly share code, notes, and snippets.

Avatar

Thierry Pigot thierrypigot

View GitHub Profile
@thierrypigot
thierrypigot / antispambot-mailto-menuLink.php
Created Jul 31, 2020
WordPress : auto add Antispambot on mailto email address inside menu links
View antispambot-mailto-menuLink.php
View gist:80a825e8010e74311c1bbafc77cedea1
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@thierrypigot
thierrypigot / wearewp-cpt-glance.php
Created Sep 16, 2019
Custom post type counts in 'Right now' Dashboard widget
View wearewp-cpt-glance.php
<?php
/*
Plugin Name: Custom post type counts
Description: Custom post type counts in 'Right now' Dashboard widget
Plugin URI: https://www.wearewp.pro
Version: 1.0
Author: WeAre[WP]
Author URI: https://www.wearewp.pro
*/
@thierrypigot
thierrypigot / wpml-config.xml
Created Aug 23, 2019
Beaver Builder theme cutomizer translation with Polylang and WPML
View wpml-config.xml
<wpml-config>
<admin-texts>
<key name="theme_mods_{THEMENAME}">
<key name="fl-topbar-col1-text" />
<key name="fl-logo-image-retina" />
<key name="fl-logo-image" />
</key>
</admin-texts>
</wpml-config>
@thierrypigot
thierrypigot / functions.php
Last active Jul 15, 2019
Defer WordPress javascript
View functions.php
<?php
// Show javascript handle
add_filter( 'script_loader_tag', 'wearewp_add_script_handle', 10, 3 );
function wearewp_add_script_handle( $tag, $handle, $src ) {
return str_replace( '<script', sprintf(
'<script data-handle="%1$s"',
esc_attr( $handle )
), $tag );
}
@thierrypigot
thierrypigot / waw-publishing.php
Last active May 21, 2019
Use this script to publish future post by server cron. USE: {site OR sub-site URL}/waw-publishing.php
View waw-publishing.php
<?php
/**
Description: Use this script to publish future post by server cron. USE: {site OR sub-site URL}/waw-publishing.php
Author: WeAre[WP]
Author URI: https://www.wearewp.pro
Version: 1.0
CRON
wget -O /dev/null https://site-A.com/waw-publishing.php
View screen-reader-text.css
.screen-reader-text {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
overflow: hidden;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
}
@thierrypigot
thierrypigot / wearewp-disable-gutenberg.php
Created Oct 31, 2018
Disable Gutenberg in WordPress 5.0
View wearewp-disable-gutenberg.php
<?php
/*
Plugin Name: WeAreWP Gutenberg
Description: Disable Gutenberg in WordPress 5.0
Plugin URI: https://www.wearewp.pro
Version: 1.0
Author: WeAre[WP]
Author URI: https://www.wearewp.pro
*/
@thierrypigot
thierrypigot / onViewport.js
Created Jun 8, 2018
Détecte si un élément entre ou sort du viewport pour lui ajouter ou enlever une class CSS
View onViewport.js
(function($) {
/**
* Copyright 2012, Digital Fusion
* Licensed under the MIT license.
* http://teamdf.com/jquery-plugins/license/
*
* @author Sam Sehnert
* @desc A small plugin that checks whether elements are within
* the user visible viewport of a web browser.
@thierrypigot
thierrypigot / functions.php
Created Jun 8, 2018
WordPress : Unregister custom post type (CPT)
View functions.php
<?php
add_action('init','waw_unregister_post_type');
function waw_unregister_post_type(){
unregister_post_type( 'bunch_services' );
unregister_post_type( 'bunch_cases' );
unregister_post_type( 'bunch_team' );
unregister_post_type( 'bunch_testimonials' );
unregister_post_type( 'bunch_faqs' );
}
You can’t perform that action at this time.