Skip to content

Instantly share code, notes, and snippets.

View bluvertigo's full-sized avatar

Andrea Gentili bluvertigo

View GitHub Profile
@bluvertigo
bluvertigo / 0_reuse_code.js
Created July 8, 2014 11:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bluvertigo
bluvertigo / functions.php
Created July 8, 2014 12:08
Shortcode - Lista categorie partendo da categoria padre
/* Woocommerce - Lista Categorie */
function woocommerce_subcats_from_parentcat_by_name($parent_cat_NAME) {
$IDbyNAME = get_term_by('slug', $parent_cat_NAME, 'product_cat');
$product_cat_ID = $IDbyNAME->term_id;
$args = array(
'hierarchical' => 1,
'show_option_none' => '',
'hide_empty' => 0,
'parent' => $product_cat_ID,
@bluvertigo
bluvertigo / functions.php
Created July 8, 2014 13:22
Shortcode - Genera una lista con i prodotti "featured" (da utilizzare con jquery cycle2 per creare una slideshow)
/* Woocommerce - Lista Prodotti Featured */
function list_featured() {
$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' => 'yes',
'posts_per_page' => 4
);
@bluvertigo
bluvertigo / functions.php
Last active September 29, 2017 07:20
Woocommerce - Nascondere dal carrello la selezione delle spese di spedizione
/**
* Hide ALL shipping options when free shipping is available and customer is NOT in certain states
* Hide Free Shipping if customer IS in those states
*
* UPDATED FOR WOOCOMMERCE 2.1
*
* Change $excluded_states = array( 'AK','HI','GU','PR' ); to include all the states that DO NOT have free shipping
*/
add_filter( 'woocommerce_package_rates', 'hide_all_shipping_when_free_is_available' , 10, 2 );
@bluvertigo
bluvertigo / whatever.md
Last active September 29, 2017 07:20
Puntate Whatever - Splendidi 40-enni e splendidi 30-enni
@bluvertigo
bluvertigo / functions.php
Created July 14, 2014 12:41
Cambiare link al bottone "Return to shop" / "Torna al Negozio"
function my_woocommerce_return_to_shop_redirect( $return_to ) {
return 'LINK_TUO_URL';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'my_woocommerce_return_to_shop_redirect', 20 );
@bluvertigo
bluvertigo / box.html
Created July 16, 2014 10:56
Woothemes - Elementi grafici preimpostati
<div class="woo-sc-box normal large"></div>
@bluvertigo
bluvertigo / functions.php
Last active September 29, 2017 07:25
Caricare file delle lingue nel child - traduzione tema child / change lang
function themename_setup() {
load_theme_textdomain('woothemes', get_stylesheet_directory().'/lang');
}
themename_setup();
@bluvertigo
bluvertigo / style.css
Created July 31, 2014 08:35
Woothemes - box rettangolari utilizzando le colonne stantard
.threecol-one {
background: none repeat scroll 0 0 #EAEAEA;
border-radius: 10px;
min-height: auto;
padding: 2%;
width: 28%;
margin-right: 1%;
text-align: center;
font-weight: bold;
}
@bluvertigo
bluvertigo / functions.php
Last active September 29, 2017 07:25
Creare un widget
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Nome Per Esteso Widget',
'id' => "nome-widget",
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '' ) );
}