Skip to content

Instantly share code, notes, and snippets.

View monecchi's full-sized avatar

Adriano Monecchi monecchi

View GitHub Profile
@monecchi
monecchi / checkout-webservice.css
Last active September 5, 2016 17:46
Cielo WooCommerce - Webservice - Credit Card Icons
/*
* Cielo WooCommerce Webservice - Credit Card brand icons on input background
* by Adriano Monecchi - Twitter: @dico_monecchi
* Download Cielo Credit Card Icons sprite images bellow:
* Cielo Credit Cards: https://cldup.com/UrOOO8uMsm.png
* Cielo Debit Card: https://cldup.com/LrSaBXSM-Z.png
* See Demo: http://pizzariameurancho.co.nf/home/checkout/
*/
/* Cielo Credit Cards */
@monecchi
monecchi / get-users-first-last-name-wordpress.php
Created December 1, 2016 23:28 — forked from kellenmace/get-users-first-last-name-wordpress.php
Get User's First and Last Name in WordPress
<?php
/**
* Get user's first and last name, else just their first name, else their
* display name. Defalts to the current user if $user_id is not provided.
*
* @param mixed $user_id The user ID or object. Default is current user.
* @return string The user's name.
*/
function km_get_users_name( $user_id = null ) {
@monecchi
monecchi / tab-active-url-hash.php
Last active January 19, 2017 03:38 — forked from corsonr/gist:0e0a4dfaacf59fdca314
WooCommerce: activate product tabs from URL
<?php
/**
* wc_direct_link_to_product_tabs
*
* Allows you to create custom URLs to activate product tabs by default, directly from the URL
* ex: http://mysite.com/my-product-name#reviews
*/
function wc_direct_link_to_product_tabs() {
if( is_product() ) {
?>
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2017.21.01
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@monecchi
monecchi / wc-customer-orders-number.php
Last active September 18, 2023 13:40
WooCommerce Customer's Orders Total - Sum of all the current month's orders made by a customer
/*********************************************************************************************/
/** Get the total sum (money spent) of orders made by a user with a "complete" status in WooCommerce. This will output the current month's sum of all orders made by the customer. **/
/*********************************************************************************************/
<?php
function current_customer_month_count( $user_id=null ) {
if ( empty($user_id) ){
$user_id = get_current_user_id();
}
@monecchi
monecchi / functions.php
Created February 23, 2017 17:12 — forked from growdev/functions.php
WooCommerce - Remove Shipping Method if Shipping Zone Selected
<?php
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways( $gateways ) {
$method = WC()->session->get( 'chosen_shipping_methods' );
// get the value of the radio button on the checkout page
if ( 'flat_rate:1' != $method[0] ) {
unset( $gateways['paypal'] );
}
@monecchi
monecchi / fa-icon-walker.php
Created March 9, 2017 12:56 — forked from Freekbron/fa-icon-walker.php
Font Awesome - WordPress - Custom nav walker
<?php
/**
* Custom nav walker
*
* Custom nav walker to assign icons to menu items.
*/
class FA_Icon_Walker extends Walker_Nav_Menu
{
/**
@monecchi
monecchi / high-dpi-media.css
Created March 12, 2017 18:22 — forked from marcedwards/high-dpi-media.css
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@monecchi
monecchi / get-svg.php
Created March 16, 2017 11:54 — forked from spigotdesign/get-svg.php
WordPress get SVG file contents
<?php echo file_get_contents( get_stylesheet_directory_uri() . '/img/icons/your-logo-file.svg' ); ?>
@monecchi
monecchi / class.yith-wcwl-shortcode.php
Last active March 4, 2019 20:08
Hard Fix for Yith Wishlist plugin version 2.1.1
<?php
/**
* Shortcodes class
*
* @author Your Inspiration Themes
* @package YITH WooCommerce Wishlist
* @version 1.1.5
*/
if ( ! defined( 'YITH_WCWL' ) ) { exit; } // Exit if accessed directly