$(document).ready(function(){
$('body,html').scrollTop(0);
$("#Menu-ID").on("click","a", function (event) {
var id = $(this).attr('href'),
top = $(id).offset().top -70;
$('body,html').animate({scrollTop: top}, 1500);
});
var hash = location.hash;
if($(hash).length){
var top = $(hash).offset().top -70;
$('body,html').animate({scrollTop: top}, 1500);
}
});
<ul id="Menu-ID" class="nav navbar-nav navbar-left"><li id="menu-item-1689" class="menu-item menu-item-type-custom menu-item-object-custom active current_page_item menu-item-home menu-item-1689 menu-item-style"><a href="https://www.vseunas.com/#kol-scrol" aria-current="page" class="menu-item-style menu-item-style-active">Колеровка</a></li>
<li id="menu-item-1690" class="menu-item menu-item-type-custom menu-item-object-custom active current_page_item menu-item-home menu-item-1690 menu-item-style"><a href="https://www.vseunas.com/#pr-scrol" aria-current="page" class="menu-item-style menu-item-style-active">Наши проекты</a></li>
<li id="menu-item-1691" class="menu-item menu-item-type-custom menu-item-object-custom active current_page_item menu-item-home menu-item-1691 menu-item-style"><a href="https://www.vseunas.com/#dost-scrol" aria-current="page" class="menu-item-style menu-item-style-active">Доставка</a></li>
<li id="menu-item-1692" class="menu-item menu-item-type-custom menu-item-object-custom active current_page_item menu-item-home menu-item-1692 menu-item-style"><a href="https://www.vseunas.com/#onas-scrol" aria-current="page" class="menu-item-style menu-item-style-active">О нас</a></li>
<li id="menu-item-1693" class="menu-item menu-item-type-custom menu-item-object-custom active current_page_item menu-item-home menu-item-1693 menu-item-style"><a href="https://www.vseunas.com/#kont-scrol" aria-current="page" class="menu-item-style menu-item-style-active">Контакты</a></li>
<li id="menu-item-594" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-594 menu-item-style"><a href="/tag/kras-int/" class="menu-item-style">Каталог</a></li>
</ul>
body, html {
scroll-behavior: smooth;
}
https://www.vseunas.com/#kol-scrol
<div class="col-md-12 cont-about off-pd my-list">
<h2 id="kol-scrol" class="catalog-h"><?php the_field('kolerovka'); ?></h2>
</div>
$('.menu-item-1689').on('click', function() {
$('html,body').animate({scrollTop: $('#kol-scrol').offset().top}, 1000);
});
Напиши функцию и выполняй её в двух случаях: страница загружена и/или клик по ссылке в меню.
<a href="https://www.vseunas.com/wp-content/themes/kraski/lightslider/js/settingsgallery.js"></a>
<a href="https://www.vseunas.com/"></a>
На странице каталога - ваш метод в ссылке стоит просто # вот страница каталога <a href="https://www.vseunas.com/tag/kras-int/"></a>
если нажимаю на пункт меню с # то перенаправления на страницу с нужным классном не происходит - это то чего я хочу добится. Удалось добится похожего эффекта если использовать якоря. Но тогда если ставим якорь в ссылку <a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>">
<?php endif; ?>
<img src="<?php the_post_thumbnail_url('medium'); ?>" class="product-img img-responsive" >
<?php if ($tag) : ?>
</a>
$tag = $tags[0] ?? false;
?>
<?php
$posts = get_posts("category=4&orderby=date&numberposts=4");
if ($posts) :
foreach ($posts as $post) : setup_postdata ($post);
$tags = wp_get_post_tags($post->ID);
// Получаем первый тег для поста
$tag = $tags[0] ?? false;
?>
<div class="col-md-3 col-sm-3 col-xs-12 off-pd line-item">
<div class="prod-card">
<?php if ($tag) : ?>
<a href="<?php echo esc_url(get_tag_link($tag->term_id)); ?>">
<?php endif; ?>
<img src="<?php the_post_thumbnail_url('medium'); ?>" class="product-img img-responsive" >
<?php if ($tag) : ?>
</a>
<?php endif; ?>
<div class="product-discr">
<p class="product-h"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></p>
<p class="product-short"><?php the_field('short_diskr_post') ?></p>
</div>
</div>
</div>
<?php endforeach; wp_reset_postdata(); ?>
<?php endif; ?>
// Получаем первый тег для поста
$tag = $tags[0] ?? false;