Shop page customization is overlap after filter
-
Hello, I customize my woocommerce shop page with some filter hooks, all is okay when I filter products by this plugin. my customization is overlap. if I reload the page all is okay before. I am not understanding the problem. thanks.
shop page customization code
—————————-
// title hooks
add_action( ‘woocommerce_before_main_content’, ‘shop_archive_page_customization’ );
function shop_archive_page_customization() {
if(is_product_category() or is_shop()) {
remove_action( ‘woocommerce_shop_loop_item_title’, ‘woocommerce_template_loop_product_title’, 10 );
add_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_title’, 5 );// add to cart icon
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woo_custom_product_add_to_cart_text’, 10 );
function woo_custom_product_add_to_cart_text() {
return __( ”, ‘woocommerce’ );
}// mobile version
if(wp_is_mobile()) {
remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_title’, 5 );
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_product_title’, 6 );add_filter( ‘the_title’, ‘shorten_woo_product_title’, 10, 2 );
function shorten_woo_product_title( $title, $id ) {
if ( is_shop() && get_post_type( $id ) === ‘product’ ) {
return substr( $title, 0, 15 ); // change last number to the number of characters you want
} else {
return substr( $title, 0, 15 );
}
}
}
}
}The page I need help with: [log in to see the link]
- The topic ‘Shop page customization is overlap after filter’ is closed to new replies.