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
SELECT p.ID, p.post_title, t.name AS product_type | |
FROM wp_posts AS p | |
JOIN wp_term_relationships AS tr ON tr.object_id = p.id | |
JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id=tt.term_taxonomy_id | |
JOIN wp_terms AS t ON t.term_id = tt.term_id | |
WHERE p.id = 111 AND tt.taxonomy = 'product_type' |
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
/** | |
* Update the whole wishlist every time an item is added or removed, considering the wishlist is always present in all pages | |
* Plugin: Wish list for WooCommerce | |
*/ | |
jQuery(document).ready(function($){ | |
//Get your wish list element first (Replace it by your wish list css class) | |
var wish_list_div = '.wish-list'; |
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 | |
function woocommerce_version_check( $version = '3.0' ) { | |
if ( class_exists( 'WooCommerce' ) ) { | |
global $woocommerce; | |
if( version_compare( $woocommerce->version, $version, ">=" ) ) { | |
return true; | |
} | |
} | |
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 | |
add_filter( 'woocommerce_checkout_fields', function ( $fields ) { | |
$offset = 2; //Change this by the field position you want to add (remembering it starts from zero) | |
$custom_field_id = 'billing_wcj_checkout_field_1'; //Your custom field id | |
$oldArray = $fields['billing']; | |
$custom_field = array( $custom_field_id => $oldArray[ $custom_field_id ] ); | |
$newArray = array_slice( $oldArray, 0, $offset, true ) + $custom_field + array_slice( $oldArray, $offset, null, true ); | |
$fields['billing'] = $newArray; | |
return $fields; | |
}, PHP_INT_MAX ); |
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
/** | |
* Convert a string to Boolean. | |
* It handles 'True' and 'False' Strings written as Lowercase or Uppercase. | |
* It also detects '0' and '1' Strings | |
*/ | |
function convertToBoolean(variable){ | |
variable = variable.toLowerCase(); | |
return Boolean(variable == true | variable === '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 | |
add_filter( 'wp_get_nav_menu_items', function($items, $menu, $args){ | |
if($menu->name!='Rodapé-3'){ | |
return $items; | |
} | |
if(is_admin()){ | |
return $items; | |
} | |
$contactDetails = get_option('contact'); |
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 | |
//Shows out of stock message when a variable product has all variations out of stock | |
add_filter('wp_footer', function(){ | |
if(is_product()){ | |
global $product; | |
if($product->is_type('variable')){ | |
if(!$product->is_in_stock()){ | |
?> | |
<script> | |
jQuery(window).load(function(){ |
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 | |
//Replaces product price by out of stock message in case a variable product is out of stock (optional) | |
add_action('woocommerce_before_single_product_summary',function(){ | |
if(is_product()){ | |
global $product; | |
if(!$product->is_in_stock()){ | |
remove_action('woocommerce_single_variation','woocommerce_single_variation'); | |
remove_action('woocommerce_single_product_summary','woocommerce_template_single_price'); | |
add_action('woocommerce_single_product_summary',function(){ | |
?> |
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
{ | |
"http-basic": { | |
"bitbucket.org": { | |
"username": "email@origgami.com.br", | |
"password": "senhanobitbucket" | |
} | |
} | |
} |
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
//Colocar na opcao Additional JavaScript, dentro do admin | |
a2a_config.icon_color = "#B93437"; |