correct bg menus

This commit is contained in:
argoexpert press
2025-02-04 00:19:35 +03:00
parent 19f12627a0
commit 06f2f95ae8
7 changed files with 75 additions and 77 deletions

View File

@@ -25,11 +25,14 @@ array_push($categories, $firstElement);
$icon = get_field('icon', 'category_' . $cat->term_id);
$bg_image = get_field('bg_image', 'category_' . $cat->term_id);
$class = in_array($cat->term_id, $current_term_ids) ? 'is-active' : '';
if($bg_image){
echo "<a href='" . get_category_link($cat->term_id) . "' class='menu-vertical__item " . $class . "'>
$class = in_array($cat->term_id, $current_term_ids) ? 'is-active' : '';
echo "<a href='" . get_category_link($cat->term_id) . "' class='menu-vertical__item " . $class . "'>
<span class='menu-vertical__item-icon'><img src='" . $icon . "' alt=''></span>
<span class='menu-vertical__item-text'>$cat->name</a></span>
</a>
";
}
}

View File

@@ -17,6 +17,7 @@ foreach ($categories as $category) {
$bg_image = get_field('bg_image', 'category_' . $category->term_id);
$category_link = get_category_link($category->term_id);
?>
<?php if ($icon) : ?>
<a href="<?php echo esc_url($category_link); ?>" class="menu-link">
<div class="menu-link__bg">
<?php if ($bg_image) : ?>
@@ -30,6 +31,7 @@ foreach ($categories as $category) {
</div>
<span class="menu-link__text"><?php echo esc_html($category->name); ?></span>
</a>
<?php endif; ?>
<?php
}
?>

View File

@@ -19,7 +19,7 @@ if ($pinned_post) :
<?php echo get_the_excerpt($pinned_post->ID); ?>
</p>
</div>
<div class="tag hero-banner__tag"><?php echo esc_html(get_category_name($pinned_post)); ?></div>
</a>
<?php endif; ?>