<?php the_field('field_name', id); ?>
<?php
$actualLoop = new WP_Query(array(
'posts_per_page' => 5,
'post_type' => 'post',
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'is_actual',
'value' => '1',
'compare' => 'LIKE',
)
),
));
if ( $actualLoop->have_posts() ) : ?>
<div class="sidebar-inner-right">
<h2 class="sidebar-title"><?php _e('Актуально') ?></h2>
<?php while ( $actualLoop->have_posts() ) : $actualLoop->the_post();
$is_actual = get_field('is_actual');
?>
<?php if ($is_actual): ?>
<a href="<?php the_permalink() ?>">
<div class="news-img-block">
<div class="img-wrapper">
<?php if (has_post_thumbnail()) {
the_post_thumbnail('blog-thumb');
}else{
echo '<img class="no-img" src="'. get_bloginfo('template_directory'). '/assets/img/no-thumbnail.jpg' . '" alt="no image">';
}?>
</div>
<h3 class="news-img-block-title"><?php trim_title_words(10, '...'); ?></h3>
<div class="news-block-info">
<div class="news-block-info-item news-block-date">
<?php echo theCustomDate() ?>
</div>
<div class="news-block-info-item news-block-views">
<?php _e('Переглядів:') ?>
<?php echo getPostViews(get_the_ID()); ?>
</div>
<div class="news-block-info-item news-block-comments">
<?php echo num_comments() ?>
</div>
</div>
<div class="news-block-excerpt">
<?php echo kama_excerpt( array('maxchar'=>80) ); ?>
</div>
</div>
</a>
<?php endif ?>
<?php endwhile;?>
</div>
<?php endif; wp_reset_query(); ?>
<?php if ( have_posts() ) : $ir = 0; while ( have_posts() ) : the_post();
if ( $ir == 0 ) {
get_template_part( 'template-parts/article-wide' );
} else {
get_template_part( 'template-parts/article' );
}
$ir++; endwhile; endif; ?>
// Move WooCommerce subcategory list items into heir own <ul> separate from the product <ul>
add_action( 'init', 'move_subcat_lis' );
function move_subcat_lis() {
// Remove the subcat <li>s from the old location.
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_start', 40 );
add_action( 'woocommerce_before_shop_loop', 'msc_maybe_show_product_subcategories', 50 );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_end', 60 );
}
//Conditonally start the product loop with a <ul> contaner if subcats exist.
function msc_product_loop_start() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '<ul class="archive-category-wrapper">';
}
}
//Print the subcat <li>s in our new location.
function msc_maybe_show_product_subcategories() {
echo woocommerce_maybe_show_product_subcategories();
}
//Conditonally end the product loop with a </ul> if subcats exist.
function msc_product_loop_end() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '</ul>';
}
}
<nav class="site-nav">
<ul id="navigation">
<li data-menuanchor="about-us">
<a href="#about-us" data-lang="about_academy">Про академию</a>
</li>
<li data-menuanchor="what-we-offer">
<a href="#what-we-offer" data-lang="proposal">Что мы предлагаем</a>
</li>
<li data-menuanchor="your-benefits">
<a href="#your-benefits" data-lang="your_result">Что ты получишь</a>
</li>
<li data-menuanchor="our-blog">
<a href="#our-blog" data-lang="blog">Блог</a>
</li>
<li data-menuanchor="testimonials">
<a href="#testimonials" data-lang="feedback">Отзывы</a>
</li>
<li data-menuanchor="contacts">
<a href="#contacts" data-lang="contacts">Контакты</a>
</li>
<li class="language-switcher-wrapper">
<button class="language-switcher ua">UA</button>
</li>
</ul>
</nav>
{
"about_academy": "Про Академию",
"proposal": "Что мы предлагаем",
"your_result": "Что ты получишь",
"feedback": "Что говорят выпускники",
"blog": "Блог",
"contacts": "Контакты",
"our_mission_main": "Наша миссия"
}
{
"about_academy": "Про Академію",
"proposal": "Що ми пропонуємо",
"your_result": "Що ти отримаєш",
"feedback": "Що кажуть випускники",
"blog": "Блог",
"contacts": "Контакти",
"our_mission_main": "Наша місія"
}
(function($) {
function Translate() {
//initialization
this.init = function(attribute, lng) {
this.attribute = attribute;
this.lng = lng;
};
//translate
this.process = function() {
var _self = this;
var xrhFile = new XMLHttpRequest();
//load content data
xrhFile.open("GET", "./translations/"+this.lng+".json", false);
xrhFile.onreadystatechange = function () {
if(xrhFile.readyState === 4) {
if(xrhFile.status === 200 || xrhFile.status == 0) {
var LngObject = JSON.parse(xrhFile.responseText);
console.log(LngObject["name1"]);
var allDom = document.getElementsByTagName("*");
for(var i =0; i < allDom.length; i++){
var elem = allDom[i];
var key = elem.getAttribute(_self.attribute);
if(key != null) {
console.log(key);
elem.innerHTML = LngObject[key];
}
}
}
}
};
xrhFile.send();
};
}
// Change language
function loadNewLang(new_lang) {
var translate = new Translate();
var currentLng = new_lang;
var attributeName = 'data-lang';
translate.init(attributeName, currentLng);
translate.process();
}
loadNewLang('ua');
$('.language-switcher').on('click', function(e) {
e.preventDefault();
$('.preloader').removeAttr('style');
if($(this).hasClass('ru')) {
$(this).toggleClass('ru ua').text('UA');
loadNewLang('ua');
ln_preloader();
} else if ($(this).hasClass('ua')) {
$(this).toggleClass('ua ru').text('RU');
loadNewLang('ru');
ln_preloader();
}
});
})(jQuery);
add_action( 'woocommerce_after_shop_loop', 'your_theme_upsell_display', 15 );
function your_theme_upsell_display () {
if ( is_product_category() ) {
woocommerce_upsell_display();
}
}
add_action( 'woocommerce_after_shop_loop', 'your_theme_output_related_products', 20 );
function your_theme_output_related_products () {
if ( is_product_category() ) {
woocommerce_output_related_products();
}
}