Created
July 2, 2021 15:39
-
-
Save vladi160/95482d15a42285075ff4e29133f287f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$taxonomyTypes = get_terms(['taxonomy' => 'product_types']); | |
if($taxonomyTypes){ | |
foreach( $taxonomyTypes as $taxonomyType ) { | |
$taxonomyNames = get_terms( array( | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'taxonomy' => 'product_names', | |
'hide_empty' => true, | |
'field' => 'slug', | |
'meta_value' => $taxonomyType->term_id, | |
'meta_compare' => '=', | |
) ); | |
if($taxonomyNames){ ?> | |
<div class="ct-section-inner-wrap"> | |
<h3 class="ct-headline h3-h3"><?php echo $taxonomyType->name ?></h3> | |
</div> | |
<div class="rb_products"> | |
<?php | |
foreach( $taxonomyNames as $taxonomyName ) { | |
$id = $taxonomyName->term_id; | |
$fieldKey = 'term_' . $id; | |
$image = get_field('product_image_1', $fieldKey); | |
$url = esc_url( get_category_link( $id ) ); | |
?> | |
<div class="rb_product"> | |
<div class="rb_product_image"> | |
<a class="oxy-post-image" style="background-image: url(<?php echo $image ?>);" href="<?php echo $url; ?>"></a> | |
</div> | |
<div class="rb_product_title"> | |
<a href="<?php echo $url; ?>"><?php echo $taxonomyName->name; ?></a> | |
</div> | |
</div> | |
<?php } ?> | |
</div> | |
<?php } | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment