Skip to content

Instantly share code, notes, and snippets.

View BluePraise's full-sized avatar

Magalie Chetrit BluePraise

View GitHub Profile
@BluePraise
BluePraise / style.css
Last active December 21, 2023 13:36
Change color of image or SVG in <img>
/*
If you'd like to change an image or SVG to black set this styling on the <img>
This does not work on background-image.
example html
<figure><img src="icon.svg" /></figure>
*/
figure img {
filter: invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%);
@BluePraise
BluePraise / functions.php
Created May 11, 2022 23:22
Change WooCommerce Checkout Field Optional Text
// 2021 March
//Change "Telephone (Optional)" Text
function change_checkout_optional_text( $fields ) {
if( is_checkout() ) {
$fields['billing']['billing_phone']['required'] = 'hidden';
$fields['billing']['billing_phone']['label'] = 'Telephone (We will only use this for delivery)';
}
return $fields;
}
@BluePraise
BluePraise / functions.php
Last active September 13, 2020 20:49
Show total number of items from WooCommerce Shopping Cart in a custom badge or mini cart
// Put this code in your (child) theme:
/*
* Mini cart with total count of items.
* This does not add the total amount of price.
* Do not put the hide on it by default, because that won't work.
* Leave it in the else statement.
*/
add_filter( 'woocommerce_add_to_cart_fragments', 'add_to_cart_fragment', 10, 1 );
@BluePraise
BluePraise / script.js
Created April 19, 2020 07:12
Console.log scroll event
/* because I keep forgetting and having to google it */
window.onscroll=function(){
console.log(
'top: ' + (window.pageYOffset || document.documentElement.scrollTop) + ' ' +
'left: ' + (window.pageXOffset || document.documentElement.scrollLeft)
);
}
<?php
$sendto = "email@email.com";
$subject = "Email from Your Website";
$name = $_POST['name'];
$email = $_POST['email'];
$project = $_POST['project'];
$message = $_POST['message'];
// Header
$headers = "From: Boo!" . strip_tags($usermail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($usermail) . "\r\n";
@BluePraise
BluePraise / functions.php
Created February 16, 2017 08:44
How to remove sorting from the WooCommerce Storefront Theme
<?php
add_action('init','delay_remove');
function delay_remove() {
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
}
@BluePraise
BluePraise / functions.php
Last active April 14, 2018 12:21
Remove Contactform7 scripts from WP pages
// Put this script in your functions.php
// I have very little pages, and I am sure it can be improved
// or adjusted to suit your own project.
//Deregister the scripts.
function deregister_contact_form() {
// You can put here all the pages where there is no contact form
if ( ! is_page( 'contact' ) ) {
remove_action('wp_enqueue_scripts', 'wpcf7_enqueue_scripts');
}
@BluePraise
BluePraise / gist:38c2984225badb957f62
Created December 10, 2014 13:23
Set Path to Gulp Globally on Windows
// http://stackoverflow.com/questions/9546324/adding-directory-to-path-environment-variable-in-windows
// Paste this in your cmd terminal and replace [username]
// with your computer username. This is to tell your computer
// that your npm packages are in this directory.
set PATH=%PATH%; C:\Users\[username]\AppData\Roaming\npm