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 | |
// Adding a hook callback. | |
add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' ); | |
add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' ); | |
function custom_woocommerce_catalog_orderby( $sortby ) { | |
$sortby['title_asc'] = __('Alphabetical - (A - Z)', 'your-theme'); | |
$sortby['title_desc'] = __('Alphabetical - (Z - A)', 'your-theme'); | |
return $sortby; | |
} |
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 sorting options | |
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); | |
function custom_woocommerce_get_catalog_ordering_args( $args ) { | |
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); | |
if ('title_asc' == $orderby_value) { | |
$args['orderby'] = 'title'; | |
$args['order'] = 'ASC'; | |
$args['meta_key'] = ''; |
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 dimensions in Additional Information tab | |
add_filter( 'wc_product_enable_dimensions_display', '__return_false' ); | |
//Hide Additional Information tab | |
function custom_woocommerce_product_tabs( $tabs ) { | |
if ( isset( $tabs['additional_information'] ) ) { | |
unset( $tabs['additional_information'] ); |
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 rel prettyphoto to all images */ | |
function autoadd_rel_prettyPhoto($content) { | |
global $post; | |
$pattern = "/(<a(?![^>]*?data-rel=['\"]prettyPhoto.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)['\"][^\>]*)>/i"; | |
$replacement = '$1 data-rel="prettyPhoto['.$post->ID.']">'; | |
$content = preg_replace($pattern, $replacement, $content); | |
return $content; | |
} | |
add_filter("the_content","autoadd_rel_prettyPhoto"); |
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 o Field de Informação adicional | |
add_filter( 'woocommerce_checkout_fields' , 'alter_woocommerce_checkout_fields' ); | |
function alter_woocommerce_checkout_fields( $fields ) { | |
unset($fields['order']['order_comments']); | |
return $fields; | |
} | |
// Remove o título de Informação adicional | |
add_filter( 'woocommerce_enable_order_notes_field', '__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 | |
/* | |
* 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 | |
/* | |
* 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> |
NewerOlder