/** * Flatsome functions and definitions * * @package flatsome */ require get_template_directory() . '/inc/init.php'; /** * Note: It's not recommended to add any custom code here. Please use a child theme so that your customizations aren't lost during updates. * Learn more here: http://codex.wordpress.org/Child_Themes */ add_filter('use_block_editor_for_post', '__return_false'); add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_company']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_last_name']); return $fields; } function pttuan_category_product_ux_builder(){ add_ux_builder_shortcode('pttuan_product_cat', array( 'name' => __('Pttuan product category'), 'category' => __('Content'), 'info' => 'Sp của Pttuan', 'wrap' => false, 'options' => array( 'text' => array( 'type' => 'textfield', 'heading' => 'Title', 'default' => 'Sản phẩm của PTTUAN', 'auto_focus' => true, ), 'color' => array( 'type' => 'colorpicker', 'heading' => __( 'Color' ), 'alpha' => true, 'format' => 'rgb', 'position' => 'bottom right', ), 'ids' => array( 'type' => 'select', 'heading' => 'Categories', 'param_name' => 'ids', 'config' => array( 'multiple' => true, 'placeholder' => 'Select..', 'termSelect' => array( 'post_type' => 'product_cat', 'taxonomies' => 'product_cat' ), ) ), ), )); } add_action('ux_builder_setup', 'pttuan_category_product_ux_builder'); function pttuan_product_cat_shortcode( $atts, $content = null ){ extract( shortcode_atts( array( 'ids' => '', 'text' => 'Sản phẩm của PTTUAN', 'color' => '', ), $atts ) ); $css_args = array( array( 'attribute' => 'margin-top', 'value' => $margin_top), array( 'attribute' => 'margin-bottom', 'value' => $margin_bottom), ); $css_args_title = array(); if($color){ $css_args_title[] = array( 'attribute' => 'color', 'value' => $color); } $orderby = 'name'; $order = 'asc'; $hide_empty = true ; $idss = array(); if ( isset( $atts[ 'ids' ] ) ) { $ids = explode( ',', $atts[ 'ids' ] ); $ids = array_map( 'trim', $ids ); $parent = ''; $orderby = 'include'; } else { $ids = array(); } $cat_args = array( 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'product_cat', $cat_args ); if( !empty($product_categories) ){ $ptt_html_cat_custom = ''; $ptt_html_cat_custom .= '