', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'beauty_lab_pingback_header' ); /** * Filter the except length to 25 words. * * @param int $length Excerpt length. * @return int modified excerpt length. */ function beauty_lab_excerpt_length( $length ) { if( get_post_type() == 'beauty-service' ){ return 10; }else{ return 22; } } add_filter( 'excerpt_length', 'beauty_lab_excerpt_length', 999 ); /** * Filter excerpt more remove [...] from the except. * * @param int $more Excerpt more. * @return emty modified excerpt. */ function beauty_lab_excerpt_more( $more ) { return ''; } add_filter('excerpt_more', 'beauty_lab_excerpt_more'); /** * add span on categories count. */ add_filter('wp_list_categories', 'beauty_lab_cat_count_span'); function beauty_lab_cat_count_span( $cat_span ) { if( is_shop() || is_product_category() || is_product_tag() ){ $cat_span = str_replace('(', '', $cat_span); $cat_span = str_replace(')', '', $cat_span); }else{ $cat_span = str_replace(' (', ' ', $cat_span); $cat_span = str_replace(')', '', $cat_span); } return $cat_span; } /** * add span on archives count. */ add_filter('get_archives_link', 'beauty_lab_archives_count_span'); function beauty_lab_archives_count_span( $archives_count ) { $archives_count = str_replace(' (', ' ', $archives_count); $archives_count = str_replace(')', '', $archives_count); return $archives_count; } /** * remove () bracket from woocommerce layered nav count span. */ add_filter('woocommerce_layered_nav_count', 'beauty_lab_layered_nav_count'); function beauty_lab_layered_nav_count( $count ) { $count = str_replace('(', '', $count); $count = str_replace(')', '', $count); return $count; } /** * remove () bracket and add span on woocommerce rating filter count. */ add_filter('woocommerce_rating_filter_count', 'beauty_lab_rating_filter_count'); function beauty_lab_rating_filter_count( $count ) { $count = str_replace('(', '', $count); $count = str_replace(')', '', $count); return $count; } /** * Change comment form textarea to use placeholder * * @since 1.0.0 * @param array $args * @return array */ function beauty_lab_comment_textarea_placeholder( $args ) { $args['comment_field'] = str_replace( 'textarea', 'textarea placeholder="' . esc_attr__( "Your message here*", "beauty-lab" ) . '"', $args['comment_field'] ); return $args; } add_filter( 'comment_form_defaults', 'beauty_lab_comment_textarea_placeholder' ); /** * Comment Form Fields Placeholder * Remove url & cookies field from comment form * */ function beauty_lab_comment_form_fields( $fields ) { foreach( $fields as &$field ) { $field = str_replace( 'id="author"', 'id="author" placeholder="' . esc_attr__( "Name*", "beauty-lab" ) . '"', $field ); $field = str_replace( 'id="email"', 'id="email" placeholder="' . esc_attr__( "Email*", "beauty-lab" ) . '"', $field ); $field = str_replace( 'id="url"', 'id="url" placeholder="' . esc_attr__( "Website", "beauty-lab" ) . '"', $field ); } unset($fields['url']); unset( $fields['cookies'] ); return $fields; } add_filter( 'comment_form_default_fields', 'beauty_lab_comment_form_fields' ); /** * Change the comment list date format * @since 1.0.0 * @param string $date * @return string */ function beauty_lab_change_comment_date_format( $date ) { $date = date("M d Y"); return $date; } add_filter( 'get_comment_date', 'beauty_lab_change_comment_date_format' ); /** * Change the product single review title */ function beauty_lab_product_single_reviews_title( $reviews_title, $count ){ $reviews_title = explode("for",$reviews_title); return $reviews_title[0]; } add_filter( 'woocommerce_reviews_title', 'beauty_lab_product_single_reviews_title', 3, 2 ); /** * Change the product upsells products heading */ function beauty_lab_product_upsells_products_heading(){ return __( 'You may also like', 'beauty-lab' ); } add_filter( 'woocommerce_product_upsells_products_heading', 'beauty_lab_product_upsells_products_heading'); /** * Change the product related products heading */ function beauty_lab_product_related_products_heading(){ return __( 'YOU MAY ALSO LIKE THIS PRODUCTS', 'beauty-lab' ); } add_filter( 'woocommerce_product_related_products_heading', 'beauty_lab_product_related_products_heading'); /** * Change the product cross sells products heading */ function beauty_lab_product_cross_sells_products_heading(){ return __( 'You may be interested in', 'beauty-lab' ); } add_filter( 'woocommerce_product_cross_sells_products_heading', 'beauty_lab_product_cross_sells_products_heading'); /** * add open tag woocommerce_before_customer_login_form */ function beauty_lab_before_customer_login_form(){ echo '
'; } add_filter( 'woocommerce_before_customer_login_form', 'beauty_lab_before_customer_login_form'); /** * add open tag woocommerce_after_customer_login_form */ function beauty_lab_after_customer_login_form(){ echo '
'; } add_filter( 'woocommerce_after_customer_login_form', 'beauty_lab_after_customer_login_form'); //---check nonce---- function is_nonce( $nonce_field, $nonce_action, $post_id){ $nonce = isset($_POST[$nonce_field]) ? $_POST[$nonce_field] : ''; if($nonce == ''){ return false; } if(!wp_verify_nonce( $nonce, $nonce_action )){ return false; } if(!current_user_can( 'edit_post', $post_id )){ return false; } if( wp_is_post_autosave( $post_id ) ){ return false; } if( wp_is_post_revision( $post_id ) ) { return false; } return true; } /** * add metabox for breadcrumb shot description */ function beautylab_breadcrumb_description() { add_meta_box( 'breadcrumb_desc_metabox', __( 'Breadcrumb Short Description', 'beauty-lab' ), 'breadcrumb_description_metaboxes_display', 'page', 'normal', 'high' ); } add_action( 'add_meta_boxes', 'beautylab_breadcrumb_description' ); function breadcrumb_description_metaboxes_display( $post ){ wp_nonce_field( 'beautylab_breadcrumb_desc_nonce_action', 'beautylab_breadcrumb_desc_nonce' ); $breadcrumb_desc = get_post_meta($post->ID, 'breadcrumb_desc', true); $html = ''; $html .= ''; echo $html; } /** * Save breadcrumb metaboxes */ add_action('save_post', 'beautylab_breadcrumb_description_metaboxes_save'); function beautylab_breadcrumb_description_metaboxes_save( $post_id ){ if( !is_nonce('beautylab_breadcrumb_desc_nonce', 'beautylab_breadcrumb_desc_nonce_action', $post_id) ){ return $post_id; } $breadcrumb_desc = isset($_POST['breadcrumb_desc']) ? $_POST['breadcrumb_desc'] : ''; update_post_meta($post_id, 'breadcrumb_desc', $breadcrumb_desc); }