$args = array(
'numberposts' => -1,
'post_type' => 'apartment',
'meta_query' => $meta_query
)
the_posts_navigation()
, проверяйте $term_child->parent
, чтобы понять где ошибка <?php echo do_shortcode( '[shortcode var="' . get_field("var") . '"]' ); ?>
var_dump( is_product_category() );
вернет вам false, то вы находитесь вне главного цикла и $wp_query еще не определенаadd_filter('woocommerce_get_catalog_ordering_args', 'my_woocommerce_order');
function my_woocommerce_order($args){
if ( is_product_category( 16 ) ) {
$args['meta_key']='diametr';
$args['orderby']='meta_value_num';
$args['order']='asc';
}
return $args;
}
get_the_terms()
, собрать из них массив ids и с помощью in_array()
проверить наличие нужного значения в массивеif ( is_product() ) {
$product_cats = get_the_terms( get_the_ID(), 'product_cat' );
$cats_array = array();
foreach ( $product_cats as $key => $product_cat ) {
$cats_array[] = $product_cat->term_id;
}
if ( in_array( "10" , $cats_array ) ) {
// Код ...
}
}