/home/ytevagd/public_html/wp-content/themes/flatsome/inc/woocommerce/structure-wc-helpers.php
<?php
// Get Product Lists
function ux_list_products( $args ) {
if ( isset( $args ) ) {
$options = $args;
$number = 8;
if ( isset( $options['products'] ) ) {
$number = $options['products'];
}
$show = ''; // featured, onsale.
if ( isset( $options['show'] ) ) {
$show = $options['show'];
}
$page_number = '1';
if ( isset( $options['page_number'] ) ) {
$page_number = $options['page_number'];
}
$orderby = 'date';
$order = 'desc';
if ( isset( $options['orderby'] ) ) {
$orderby = $options['orderby'];
}
if ( isset( $options['order'] ) ) {
$order = $options['order'];
}
if ( $orderby == 'menu_order' ) {
$order = 'asc';
}
$tags = array();
if ( isset( $options['tags'] ) ) {
$_tags = array_filter( array_map( 'trim', explode( ',', $options['tags'] ) ) );
$tags = array_map( function ( $tag ) {
if ( is_numeric( $tag ) ) {
$term = get_term( $tag );
if ( $term instanceof WP_Term ) {
return $term->slug;
}
}
return $tag;
}, $_tags );
}
$offset = '';
if ( isset( $options['offset'] ) ) {
$offset = $options['offset'];
}
} else {
return false;
}
$query_args = array(
'posts_per_page' => $number,
'post_status' => 'publish',
'post_type' => 'product',
'paged' => $page_number,
'ignore_sticky_posts' => 1,
'order' => $order,
'product_tag' => $tags,
'offset' => $offset,
'meta_query' => WC()->query->get_meta_query(), // @codingStandardsIgnoreLine
'tax_query' => WC()->query->get_tax_query(), // @codingStandardsIgnoreLine
);
switch ( $show ) {
case 'featured':
$query_args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
'operator' => 'IN',
);
break;
case 'onsale':
$query_args['post__in'] = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
break;
}
switch ( $orderby ) {
case 'menu_order':
$query_args['orderby'] = 'menu_order';
break;
case 'title':
$query_args['orderby'] = 'name';
break;
case 'date':
$query_args['orderby'] = 'date';
break;
case 'price':
$query_args['meta_key'] = '_price'; // @codingStandardsIgnoreLine
$query_args['orderby'] = 'meta_value_num';
break;
case 'rand':
$query_args['orderby'] = 'rand'; // @codingStandardsIgnoreLine
break;
case 'sales':
$query_args['meta_key'] = 'total_sales'; // @codingStandardsIgnoreLine
$query_args['orderby'] = 'meta_value_num';
break;
default:
$query_args['orderby'] = 'date';
}
$query_args = ux_maybe_add_category_args( $query_args, $options['cat'], 'IN' );
if ( isset( $options['out_of_stock'] ) && $options['out_of_stock'] === 'exclude' ) {
$product_visibility_term_ids = wc_get_product_visibility_term_ids();
$query_args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'term_taxonomy_id',
'terms' => $product_visibility_term_ids['outofstock'],
'operator' => 'NOT IN',
);
}
$results = new WP_Query( $query_args );
return $results;
} // List products
/**
* Set categories query args if not empty.
*
* @param array $query_args Query args.
* @param string $category Shortcode category attribute value.
* @param string $operator Query Operator.
*
* @return array $query_args
*/
function ux_maybe_add_category_args( $query_args, $category, $operator ) {
if ( ! empty( $category ) ) {
if ( empty( $query_args['tax_query'] ) ) {
$query_args['tax_query'] = array(); // @codingStandardsIgnoreLine
}
$categories = array_map( 'sanitize_title', explode( ',', $category ) );
$field = 'slug';
if ( is_numeric( $categories[0] ) ) {
$field = 'term_id';
$categories = array_map( 'absint', $categories );
// Check numeric slugs.
foreach ( $categories as $cat ) {
$the_cat = get_term_by( 'slug', $cat, 'product_cat' );
if ( false !== $the_cat ) {
$categories[] = $the_cat->term_id;
}
}
}
$query_args['tax_query'][] = array(
'taxonomy' => 'product_cat',
'terms' => $categories,
'field' => $field,
'operator' => $operator,
);
}
return $query_args;
}
global $pagenow;
if ( ! get_theme_mod( 'activated_before' ) && is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) {
/**
* Set Default WooCommerce Image sizes upon theme activation.
*/
function flatsome_woocommerce_image_dimensions() {
$single = array(
'width' => '510',
'height' => '600',
'crop' => 1,
);
$catalog = array(
'width' => '247',
'height' => '300',
'crop' => 1,
);
update_option( 'woocommerce_single_image_width', $single['width'] );
update_option( 'woocommerce_thumbnail_image_width', $catalog['width'] );
update_option( 'woocommerce_thumbnail_cropping', 'custom' );
update_option( 'woocommerce_thumbnail_cropping_custom_width', 5 );
update_option( 'woocommerce_thumbnail_cropping_custom_height', 6 );
}
add_action( 'init', 'flatsome_woocommerce_image_dimensions', 1 );
/**
* Set a theme mod to retrieve first activation state from.
*/
function flatsome_first_activation_state() {
if ( ! get_theme_mod( 'activated_before' ) ) {
set_theme_mod( 'activated_before', true );
}
}
add_action( 'shutdown', 'flatsome_first_activation_state' );
}
Run Command [Bypass]
Run Command
CVARA – NHẬP KHẨU PHÁP – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG. - Giải pháp chăm sóc tại nhà Việt Nam
Chuyển đến nội dung
Home / THỰC PHẨM CHỨC NĂNG / CƠ - XƯƠNG - KHỚP
CVARA – NHẬP KHẨU PHÁP – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG.
CVARA – NHẬP KHẨU PHÁP – BỔ SUNG CALCI NANO VITAMIN D3 VÀ MK7 – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG.
CVARA – NHẬP KHẨU PHÁP – BỔ SUNG CALCI NANO VITAMIN D3 VÀ MK7 – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG
– Bổ sung Canxi nhằm hỗ trợ phát triển chiều cao cho thanh thiếu niên trong độ tuổi phát triển chiều cao, giúp xương chắc khỏe, phòng ngừa còi xương ở trẻ em
– Chống loãng xương, giúp phục hồi xương gãy, giảm đau lưng cho người lớn, ngăn chặn các hiện tượng thoái hóa, giòn xương do thiếu canxi trong máu, giúp cơ thể khỏe mạnh
– Giảm tình trạng viêm khớp, thoái hóa khớp. Cung cấp canxi, vitamin D3 cho phụ nữ có thai và cho con bú. Tăng cường và phát triển hệ xương ở thai nhi
– Giảm tê bì chân tay, chuột rút. Kết hợp hỗ trợ điều trị thiếu canxi huyết
CAM KẾT HÀNG CHÍNH HÃNG – GIÁ CẢ HỢP LÝ – TIẾT KIỆM 5-7% – GIAO HÀNG TOÀN QUỐC.
CVARA – NHẬP KHẨU PHÁP – GIÚP PHÁT TRIỂN CHIỀU CAO VÀ PHÒNG CHỐNG LOÃNG XƯƠNG. quantity
Mua Hàng