@php
$dataLayerLabel = $dataLayerLabel ?? ''; // string applied as css-class
$excludePosts = [];
$bodyClassModifier = $bodyClassModifier ?? '';
@endphp
@while (have_posts()) @php the_post() @endphp
-
@include('partials.tile', ['dataLayerLabel' => $dataLayerLabel])
@php
$excludePosts[] = get_the_ID();
@endphp
@endwhile
@if ($dataLayerLabel == "Categoria Tag")
@php
$my_current_lang = apply_filters( 'wpml_current_language', NULL );
$tag = get_queried_object();
do_action('disable_wpml_auto_id');
$enId = apply_filters( 'wpml_object_id', $tag->term_id, 'category', true, 'en-gb');
$enTag = get_term($enId);
do_action('enable_wpml_auto_id');
$acfTag = get_field('sub_tags_choice', $tag);
$acfTagEn = get_field('sub_tags_choice', $enTag);
$idToTranslate = [];
if (is_array($acfTagEn)) {
for ($i=0; $i < count($acfTagEn); $i++) {
do_action('disable_wpml_auto_id');
$enSubId = apply_filters( 'wpml_object_id', $acfTagEn[$i]['value'], 'category', true, $my_current_lang);
$enSubTag = get_term($enSubId);
do_action('enable_wpml_auto_id');
$idToTranslate[] = (int)$acfTagEn[$i]['value'];
}
}
@endphp
@if (!empty($idToTranslate))
@php
$query = new WP_Query([
'post_type' => 'post',
'posts_per_page' => -1,
'post__not_in' => $excludePosts,
'tag__in' => $idToTranslate
]);
@endphp
@while ($query->have_posts()) @php $query->the_post() @endphp
-
@include('partials.tile', ['dataLayerLabel' => $dataLayerLabel])
@endwhile
@php wp_reset_postdata(); @endphp
@endif
@endif
@if ($dataLayerLabel == "Search")
@php
$userSearch = get_search_query();
$cardContainer = get_field('card_container' ,'option');
// ADD SPECIFIC KEYWORLD CASE
switch ($userSearch) {
case 'Wallet':
case 'wallet':
$userSearch = "Wallets Small Accessories";
break;
case 'Portafogli':
case 'portafogli':
$userSearch = "Portafogli Piccola Pelletteria";
break;
case 'Portefeuilles':
case 'portefeuilles':
$userSearch = "Portefeuilles Petite Maroquinerie";
break;
case 'Kleinlederwaren':
case 'kleinlederwaren':
$userSearch = "Portemonnaies Kleinlederwaren";
break;
case 'Carteras':
case 'carteras':
$userSearch = "Carteras Marroquinería";
break;
case 'Кошельки':
case 'kошельки':
$userSearch = "Кошельки небольшие аксессуары";
break;
default:
$userSearch = get_search_query();
}
@endphp
@foreach ($cardContainer as $key => $card)
@if (stripos($userSearch, $card['title']) !== false)
{{-- CARD MATCH --}}
@php
$title = '';
switch ($card['title']) {
case "SHOES":
$title = "shoes";
break;
case "BELTS":
$title = "belt";
break;
case "BAGS":
$title = "bag";
break;
case "HANDBAGS":
$title = "handbag";
break;
case "RINGS":
$title = "rings";
break;
case "SNEAKERS":
$title = "sneakers";
break;
case "JEWELLERY":
$title = "jewellery";
break;
case "OFF THE GRID":
$title = "otg";
break;
case "WALLETS SMALL ACCESSORIES":
$title = "wallets&accessories";
break;
case "EYEWEAR SUNGLASSES":
$title = "eyewear";
break;
default:
$title = "";
}
@endphp
-