Skip to content

Instantly share code, notes, and snippets.

View monecchi's full-sized avatar

Adriano Monecchi monecchi

View GitHub Profile
@monecchi
monecchi / functions.php
Created February 23, 2018 20:02 — forked from claudiosanches/functions.php
WooCommerce - Botão orçar
<?php
function cs_add_to_cart_text( $text ) {
return __( 'Orçar' );
}
// Loop.
add_filter( 'woocommerce_product_add_to_cart_text', 'cs_add_to_cart_text' );
// Single.
add_filter( 'woocommerce_product_single_add_to_cart_text', 'cs_add_to_cart_text' );
@monecchi
monecchi / functions.php
Created February 23, 2018 20:00 — forked from claudiosanches/functions.php
WooCommerce - Variable product with custom price labels
function custom_variable_price_html( $price, $product ) {
$price = '';
if ( ! $product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) {
$price .= '<span class="from">' . __( 'A partir de' ) . ' </span>';
}
$price .= woocommerce_price( $product->get_price() );
if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {
@monecchi
monecchi / chrome-color-scheme-alt.tmTheme
Created January 25, 2018 05:39
Modified Chrome Color Scheme for Sublime Text with better syntax for mixed PHP HTML JS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>author</key>
<string>Mattia Astorino</string>
@monecchi
monecchi / function-localize.php
Created June 19, 2017 15:17 — forked from neilgee/function-localize.php
wp_localize_script using Booleans & Integers
<?php
//wp_localize_script by default passes everything in as strings so for booleans and integers when being referenced in your javascript you need to do some trickery
//Example 1 - passing in booleans as strings
$options = get_option('ng_slicknavmenu');
// Add PHP plugin variables to the $params[] array to pass to jQuery
$data = array (
'ng_slicknav_menu' => $options['ng_slicknav_menu'],
'ng_slicknav_position' => $options['ng_slicknav_position'],
@monecchi
monecchi / responsive-jquery-spectragram-helper.js
Created May 21, 2017 00:27
Helper js function for responsive jQuery Spectragram plugin
/**
* Helper function for responsive jQuery Spectragram
* @require - jquery-spectragram.js plugin - https://github.com/adrianengine/jquery-spectragram
*/
// Target the spectragram's wrapper as per the plugin's docs:
var insta = jQuery('#instagram_feed');
// Check for the wrapper's presence in the DOM
if (insta.length) {
!function(a){jQuery.fn.responsiveInstagram=function(b){var c,d,e,f=a(this),g=a(window).width();return e={width:610,extraHeight:80,breakpoint:620},b=a.extend(e,b),g<=b.breakpoint?f.css("width","100%"):f.css("width",b.width.toString(10)+"px"),c=f.width(),d=Math.round(c+b.extraHeight),f.css("height",d.toString(10)+"px"),this}}(jQuery);
@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
@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 / 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 / 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 / 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'] );
}