add_action('wp_enqueue_scripts', 'kowine_child_css', 1001); // Load CSS function kowine_child_css() { wp_deregister_style( 'styles-child' ); wp_register_style( 'styles-child', get_stylesheet_directory_uri() . '/style.css',array(), time()); wp_enqueue_style( 'styles-child' ); add_action( 'woocommerce_created_customer', 'wc_save_registration_form_fields' ); function wc_save_registration_form_fields( $customer_id ) { if ( isset($_POST['role']) ) { if( $_POST['role'] == 'restaurant' ){ $user = new WP_User($customer_id); $user->set_role('restaurant'); } } } function wp_restrict_horeca_page() { global $post; $page_id = 24911; if ( is_page() && ( $post->post_parent == $page_id || is_page( $page_id ) ) ) { $redirect = true; if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); if ( current_user_can( 'manage_options' ) || in_array( 'restaurant', (array) $current_user->roles ) || in_array( 'hotel', (array) $current_user->roles ) ) { $redirect = false; } } if ( $redirect ) { wp_redirect( esc_url( home_url( '/' ) ), 307 ); } } } add_action( 'template_redirect', 'wp_restrict_horeca_page' ); function misha_remove_default_sorting_options( $options ){ unset( $options[ 'popularity' ] ); // Sort by popularity unset( $options[ 'menu_order' ] ); // Default sorting unset( $options[ 'rating' ] ); // Sort by average rating $options[ 'date' ] = 'Sort by Best Seller'; // rename return $options; } add_filter( 'woocommerce_catalog_orderby', 'misha_remove_default_sorting_options' ); add_action('admin_head', 'my_custom_fonts'); function my_custom_fonts() { echo ''; } add_action('woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields'); add_action('woocommerce_process_product_meta', 'woocommerce_product_custom_fields_save'); function woocommerce_product_custom_fields() { global $woocommerce, $post; echo '
'; echo ''; } function woocommerce_product_custom_fields_save($post_id) { $woocommerce_custom_product_text_field = $_POST['_vivino_review_link']; if (!empty($woocommerce_custom_product_text_field)) update_post_meta($post_id, '_vivino_review_link', esc_attr($woocommerce_custom_product_text_field)); $woocommerce_custom_product_text_field2 = $_POST['_vivino_vintage_id']; if (!empty($woocommerce_custom_product_text_field2)) update_post_meta($post_id, '_vivino_vintage_id', esc_attr($woocommerce_custom_product_text_field2)); }