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 | |
/* | |
* Search in Specific Post Type | |
*/ | |
function search_specific_post_type($query) { | |
if ($query->is_search) { | |
$query->set('post_type', array('post')); | |
}; | |
return $query; | |
}; |
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 Stock Quantity in Catalog Loop | |
*/ | |
function odin_stock_catalog() { | |
global $product; | |
if ( $product->is_in_stock() ) { | |
echo '<div class="stock" >' . $product->get_stock_quantity() . __( 'EM ESTOQUE', 'odin' ) . '</div>'; | |
} else { | |
echo '<div class="out-of-stock" >' . __('SEM ESTOQUE', 'odin' ) . '</div>'; |
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 wysija shortcode after the_content | |
*/ | |
add_filter( 'the_content', 'chr_add_after_content' ); | |
function chr_add_after_content( $content ) { | |
if( is_single() ) : | |
$custom_content .= $content; | |
$custom_content .= '<h2 class="widgettitle">Newsletter</h2>'; |
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 Widget Product Gallery - WooCommerce | |
*/ | |
add_action( 'add_meta_boxes' , 'chr_remove_meta_boxe', 40 ); | |
function chr_remove_meta_boxe(){ | |
remove_meta_box( 'woocommerce-product-images', 'product', 'side'); | |
} |
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 Remove Special Characters and Convert Text in Lowercase | |
*/ | |
function chrConvertText($text) { | |
$transliterationTable = array('á' => 'a', 'Á' => 'A', 'à' => 'a', 'À' => 'A', 'ă' => 'a', 'Ă' => 'A', 'â' => 'a', 'Â' => 'A', 'å' => 'a', 'Å' => 'A', 'ã' => 'a', 'Ã' => 'A', 'ą' => 'a', 'Ą' => 'A', 'ā' => 'a', 'Ā' => 'A', 'ä' => 'ae', 'Ä' => 'AE', 'æ' => 'ae', 'Æ' => 'AE', 'ḃ' => 'b', 'Ḃ' => 'B', 'ć' => 'c', 'Ć' => 'C', 'ĉ' => 'c', 'Ĉ' => 'C', 'č' => 'c', 'Č' => 'C', 'ċ' => 'c', 'Ċ' => 'C', 'ç' => 'c', 'Ç' => 'C', 'ď' => 'd', 'Ď' => 'D', 'ḋ' => 'd', 'Ḋ' => 'D', 'đ' => 'd', 'Đ' => 'D', 'ð' => 'dh', 'Ð' => 'Dh', 'é' => 'e', 'É' => 'E', 'è' => 'e', 'È' => 'E', 'ĕ' => 'e', 'Ĕ' => 'E', 'ê' => 'e', 'Ê' => 'E', 'ě' => 'e', 'Ě' => 'E', 'ë' => 'e', 'Ë' => 'E', 'ė' => 'e', 'Ė' => 'E', 'ę' => 'e', 'Ę' => 'E', 'ē' => 'e', 'Ē' => 'E', 'ḟ' => 'f', 'Ḟ' => 'F', 'ƒ' => 'f', 'Ƒ' => 'F', 'ğ' => 'g', 'Ğ' => 'G', 'ĝ' => 'g', 'Ĝ' => 'G', 'ġ' => 'g', 'Ġ' => 'G', 'ģ' => 'g', 'Ģ' => 'G', 'ĥ' => 'h', 'Ĥ' => 'H', 'ħ' = |
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
$(function() { | |
$('.classVerticalAlign').css({ | |
'position' : 'absolute', | |
'left' : '50%', | |
'top' : '50%', | |
'margin-left' : -$('.classVerticalAlign').outerWidth()/2, | |
'margin-top' : -$('.classVerticalAlign').outerHeight()/2 | |
}); | |
}); |
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 | |
/** | |
* Custom single post format template | |
* Reference: https://codex.wordpress.org/Function_Reference/get_post_format | |
*/ | |
function chr_custom_single_post_format( $template ) { | |
if ( is_single() && has_post_format() ) { | |
$post_format_template = locate_template( 'single-' . get_post_format() . '.php' ); | |
if ( $post_format_template ) { | |
$template = $post_format_template; |
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 | |
// allow AED for WooCommerce | |
add_filter( 'woocommerce_paypal_supported_currencies', 'paypal_aed_current' ); | |
function paypal_aed_current($currency_array) { | |
$currency_array[] = 'AED'; | |
return $currency_array; | |
} |
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 symbol United Arab Emirates Dirham | |
add_filter( 'woocommerce_currencies', 'add_custom_currency' ); | |
function add_custom_currency( $currencies ) { | |
$currencies['AED'] = __( 'United Arab Emirates Dirham', 'woocommerce' ); | |
return $currencies; | |
} | |
add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2); | |
function add_custom_currency_symbol( $currency_symbol, $currency ) { |
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 | |
/* | |
* Função para adicionar um único item por carrinho | |
*/ | |
function woo_unico_produto( $cart_item_data ) { | |
global $woocommerce; | |
$woocommerce->cart->empty_cart(); | |
return $cart_item_data; | |
} |