Skip to content

Instantly share code, notes, and snippets.

View mrsize's full-sized avatar

Thomas Dufranne mrsize

View GitHub Profile
<?php
// Configuration :
function mrsize_produit_gratuit_coupon_nom(){
return 'premierefois'; // Titre du coupon
}
function mrsize_produit_gratuit_id(){
return 825; // ID du produit gratuit
}
@mrsize
mrsize / antispam.css
Created June 11, 2021 12:31
E-mail and Phone number 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 February 12, 2020 14:45
CSS Transition with Javascript (No jQuery)
<!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 February 4, 2020 11:41
CF7 Antispam Hide Honeypot Field Function
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 December 6, 2018 16:12
WordPress Search & Replace in posts
<?php
/**
*
* Search & Replace in WordPress posts
*
*/
function mytheme_go_replace(){
@mrsize
mrsize / wp_minify_html_output.func.php
Last active January 27, 2020 13:04
Wordpress Minify HTML for visitors
/*
** 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');
@mrsize
mrsize / gist:d18a5b4a676e103b5372047c585830aa
Last active December 6, 2018 19:54
Some RSS Usefull links
// 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 December 4, 2018 13:32
WPCF7 Check spam before Sending email
<?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 07:59
Antispam Wordpress CF7
<?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 February 2, 2023 05:58
Create an administrator in Wordpress via functions
<?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 );