Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Claudio Sanches claudiosanches

👨‍💻
View GitHub Profile
View post_mail.php
<?php
/**
* Wraps a message $content in a responsive e-mail template.
*
* Reference: http://zurb.com/playground/projects/responsive-email-templates/basic.html
*/
function post_mail_content( $content ) {
ob_start(); ?><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="width=device-width" name="viewport">
View bin-cc.md

Validação para cartão de crédito.

Bin e padrões para validação de cartão de crédito.

Bandeira Começa com Máximo de número Máximo de número cvc Regex
Visa 4 13,16 3 ^4[0-9]{12}(?:[0-9]{3})
Mastercard 5 16 3 ^5[1-5][0-9]{14}
Diners 301,305,36,38 link 14,16 3 ^3(?:0[0-5]&#124;[68][0-9])[0-9]{11}
View functions.php
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
global $woocommerce;
$minimum = 10;
if ( $woocommerce->cart->get_cart_total(); < $minimum ) {
$woocommerce->add_error( sprintf( 'You must have an order with a minimum of %s to place your order.' , $minimum ) );
}
}
View gist:7329142
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?></a>
View menu.php
<?php
// Activate menu function
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus( array(
'main-menu' => 'Main Menu',
'footer-menu' => 'Footer Menu', 'top_menu' => 'Top Menu', 'resp_menu' => 'Responsive Menu'
) );
View SmoothScroll.js
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Michael Herf (Pulse Algorithm)
(function(){
// Scroll Variables (tweakable)
View stopwords.txt
"abaixo","aca","acaso","acerca","acima","acola","acula","ademais","adentro","adiante","afinal","afora","agora","agorinha","ah","ainda","alem","algo","alguem","algum","alguma","algumas","alguns","ali","alias","alo","ambos","amiude","ante","antes","ao","aonde","aos","apenas","apesar","apos","apud","aquela","aquelas","aquele","aqueles","aqui","aquilo","as","assim","ate","atras","atraves","basicamente","bastante","bastantes","bem","bis","bom","ca","cada","cade","caso","certa","certamente","certas","certeiramente","certo","certos","chez","chi","comigo","como","comumente","conforme","confronte","conosco","conquanto","consequentemente","consigo","consoante","contanto","contigo","contra","contudo","convosco","cuja","cujas","cujo","cujos","da","dai","dali","dantes","daquela","daquelas","daquele","daqueles","daqui","daquilo","das","de","debaixo","defronte","dela","delas","dele","deles","demais","dentre","dentro","depois","desde","dessa","dessas","desse","desses","desta","destas","deste","destes","detras","deveras","dia
View template-print-processing-orders.php
<?php
/*
Template Name: Print Processing Orders :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@claudiosanches
claudiosanches / functions.php
Created Sep 11, 2013
WooCommerce - Max and Min
View functions.php
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
$price = '';
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
View _linear-gradient.scss
@mixin linear-gradient($angle, $color-stops...) {
$_angle-with-vendor-prefix: "";
$_angle: "";
@if $angle == "to top" or $angle == "bottom" {
$_angle-with-vendor-prefix: bottom;
$_angle: to top;
} @else if $angle == "to right" or $angle == "left" {
$_angle-with-vendor-prefix: left;
$_angle: to right;
} @else if $angle == "to bottom" or $angle == "top" {
You can’t perform that action at this time.