add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); /** * custom_woocommerce_template_loop_add_to_cart */ function custom_woocommerce_product_add_to_cart_text() { global $product; $product_type = $product->get_type(); switch ( $product_type ) { case 'external': return __( 'SELECT STYLE', 'woocommerce' ); break; case 'grouped': return __( 'SELECT STYLE', 'woocommerce' ); break; case 'simple': return __( 'SELECT STYLE', 'woocommerce' ); break; case 'variable': return __( 'SELECT STYLE', 'woocommerce' ); break; default: return __( 'SELECT STYLE', 'woocommerce' ); } } /** * Restrict native search widgets to the 'post' post type */ add_filter( 'widget_title', function( $title, $instance, $id_base ) { // Target the search base if( 'search' === $id_base ) add_filter( 'get_search_form', 'wpse_post_type_restriction' ); return $title; }, 10, 3 ); function wpse_post_type_restriction( $html ) { // Only run once remove_filter( current_filter(), __FUNCTION__ ); // Inject hidden post_type value return str_replace( '', '', $html ); }