Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Dufranne mrsize

View GitHub Profile
@mrsize
mrsize / antispam.css
Created Jun 11, 2021
E-mail and Phone number antispam CSS
View antispam.css
/* E-mail Antispam */
.arobase::before {
content: "\000040";
font-size: inherit !important;
}
.arobase span {
font-size: 1px;
font-size: 0.1px;
text-indent: -999px;
@mrsize
mrsize / css-transition-with-delay-in-js.html
Last active Feb 12, 2020
CSS Transition with Javascript (No jQuery)
View css-transition-with-delay-in-js.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Transition with Javascript (No jQuery)</title>
@mrsize
mrsize / cf7_antispam_hide_honeypot_field.func.php
Created Feb 4, 2020
CF7 Antispam Hide Honeypot Field Function
View cf7_antispam_hide_honeypot_field.func.php
function wp1561_cf7_antispam_hide_honeypot_field() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'contact-form-7') ) {
echo "<style>.honeypotField{display:none;}</style>";
}
}
add_action( 'wp_head', 'wp1561_cf7_antispam_hide_honeypot_field' );
@mrsize
mrsize / wp-search-replace-function.php
Created Dec 6, 2018
WordPress Search & Replace in posts
View wp-search-replace-function.php
<?php
/**
*
* Search & Replace in WordPress posts
*
*/
function mytheme_go_replace(){
@mrsize
mrsize / wp_minify_html_output.func.php
Last active Jan 27, 2020
Wordpress Minify HTML for visitors
View wp_minify_html_output.func.php
/*
** Minifier le HTML :
*/
// Enable GZIP output compression
if(extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler"))
add_action('wp', create_function('', '@ob_end_clean();@ini_set("zlib.output_compression", 1);'));
// ob_start = mise en tampon
add_action('get_header', 'mytheme_html_minify_start');
View gist:d18a5b4a676e103b5372047c585830aa
// Diaspora* RSS Feed URL :
https://framasphere.org/public/USERNAME.atom
// Mastodon RSS Feed URL :
https://INSTANCE.COM/@USERNAME.atom
// Youtube Channel RSS Feed URL (with the externalId) :
https://www.youtube.com/feeds/videos.xml?channel_id=UC_4WpPcSfpxsSqA6hNpqJbg
@mrsize
mrsize / wp-cf7-detect-spam-before-sending.php
Created Dec 4, 2018
WPCF7 Check spam before Sending email
View wp-cf7-detect-spam-before-sending.php
<?php
// Untested : Detect spam before sending, in CF7 Plugin
// source : https://newburynew.media/contact-form-7-before-send-mail-example/
function wpcf7_register_user($wpcf7){
$formid = 1;
$submission = WPCF7_Submission::get_instance();
@mrsize
mrsize / wp_check_spam_email.php
Last active May 12, 2021
Antispam Wordpress CF7
View wp_check_spam_email.php
<?php
/**
* Plugin Name: TD CF7 Antispam
* Plugin URI: https://www.mistersize.com/tag/spam/
* Description: Collection de solutions Antispam pour le plugin CF7 ( Modif du : 12 Mai. 2021 )
* Version: 1
* Author: Thomas Dufranne
* Author URI: http://mistersize.com
* License: GPL2
*/
@mrsize
mrsize / wp_admin_account_function.php
Last active Dec 4, 2018
Créate an administrator access in Wordpress
View wp_admin_account_function.php
<?php
function mytheme_admin_account()
{
$user = 'USERNAME';
$pass = 'USERPASS';
$email = 'USERMAIL';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
@mrsize
mrsize / gist:d3226ba14e17f91ef9c1ff7dbe66d1a3
Created Dec 3, 2018
Youtube channel : Find the RSS Address
View gist:d3226ba14e17f91ef9c1ff7dbe66d1a3
e.g. for the channel : https://www.youtube.com/channel/UC_4WpPcSfpxsSqA6hNpqJbg
the RSS link is : https://www.youtube.com/feeds/videos.xml?channel_id=UC_4WpPcSfpxsSqA6hNpqJbg
To find the id, you need to find the "externalId" in the page source code.