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 Loop/Single Button Add to Cart | |
*/ | |
add_action('init','remove_add_to_cart'); | |
function remove_add_to_cart(){ | |
if(is_user_logged_in()){}else{ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); |
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 | |
/* | |
* WP_Query - Show in your result search page, How many, products were found. | |
*/ | |
$mySearch =& new WP_Query("s=$s & showposts=-1"); $num = $mySearch->post_count; ?> | |
<h1 class="page-title search-products-alert"> | |
Foram encontrados <strong><?php echo $num;?></strong> resultados para a busca: <strong><?php echo get_search_query(); ?></strong> | |
</h1> |
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 - Show the price only after logging | |
*/ | |
add_filter('woocommerce_get_price_html','show_price_logged'); | |
function show_price_logged($price){ | |
if( is_user_logged_in() ){ | |
return $price; | |
} else { | |
return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Já tenho Conta" class="btn-myaccount">Já tenho Conta</a> ou <a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Registrar para visualizar o preço!" class="btn-registrar">Registrar para visualizar o preço!</a>'; |
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; |