This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache | |
First: | |
git rm -r --cached . | |
git add . | |
Then: | |
git commit -am "Remove ignored files" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$(".widget .product-categories > li > .children li").each(function() { | |
if($(this).has(".children")) { | |
if(!($(this).hasClass("current-cat-parent"))) { | |
$(this).find(".children").first().attr("style", "display:none;") | |
.siblings("a").attr("href", "javascript:void(0);"); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_insert_post_data', 'cg_custom_insert_post_data' ); | |
function cg_custom_insert_post_data( $data ) { | |
//You can make some checks here before modify the post data. | |
//For example, limit the changes to revista post type | |
if( 'revista' == $data['post_type'] ) { | |
$edicao_num = 'Edição: '.$_POST['_edicao_num']; | |
$data['post_name'] = sanitize_title( $edicao_num ); | |
} | |
return $data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$('a[href*=#]:not([href=#])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
$('html,body').animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Filter gateways by product ID | |
add_filter('woocommerce_available_payment_gateways', 'cg_filter_gateways', 1); | |
function cg_filter_gateways($gateways) { | |
global $woocommerce; | |
$authorized_products = array(1,2,5); | |
$gateways_to_unset = array('paypal', 'cielo'); | |
$unset_gateways = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Viewport meta tag */ | |
add_action( 'wp_head', 'cg_viewport_meta' ); | |
function cg_viewport_meta() { | |
if( is_ipad() ) : | |
echo '<meta name="viewport" content="width=device-width; initial-scale=0.8" />'; | |
else : | |
echo '<meta name="viewport" content="width=device-width;" />'; | |
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hide standard shipping option when free shipping is available | |
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 ); | |
/** | |
* Hide Standard Shipping option when free shipping is available | |
* | |
* @param array $available_methods | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
add_action( 'woocommerce_after_shop_loop_item', 'cg_loop_add_to_cart', 10 ); | |
function cg_loop_add_to_cart() { | |
// global $product; | |
// echo '<form action="' . esc_url( get_permalink( $product->id ) ) . '" method="get"> | |
// <button type="submit" class="single_add_to_cart_button button alt">View More</button> | |
// </form>'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(is_admin()) { | |
add_filter('filesystem_method', create_function('$a', 'return "direct";' )); | |
define( 'FS_CHMOD_DIR', 0751 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"files": | |
{ | |
"Equalizer": "http://raw.github.com/darkwing/Equalizer/master/Source/Equalizer.js", | |
"Normalizer": "http://raw.github.com/necolas/normalize.css/master/normalize.css", | |
"Timthumb": "http://timthumb.googlecode.com/svn/trunk/timthumb.php", | |
"jQuery": "http://code.jquery.com/jquery.min.js", | |
"jQuery Animate Shadow": "http://www.bitstorm.org/jquery/shadow-animation/archive/jquery.animate-shadow-min.js", | |
"jQuery Autosize": "http://raw.github.com/jackmoore/autosize/master/jquery.autosize-min.js", | |
"jQuery Black and White": "http://raw.github.com/GianlucaGuarini/jQuery.BlackAndWhite/master/jquery.BlackAndWhite.js", |