<?php
if(have_posts())
{
$i = 0;
while(have_posts())
{
the_post();
if($i > 3)
{
if($i == 4 || $i == 5)
{
the_title();
}
else
{
//тут 6 - не выводим и уменьшаем счётчик до 2
//на след шаге $i будет 3 и значит опять не выводим
//а потом 4, 5 вывод и так по кругу
$i = 2;
}
}
$i++;
}
}
$('ul.menu a').on('click', function(e){
var goto = $(this).data('anchor');
$('html,body').stop().animate({ scrollTop: $(goto).offset().top-60 }, 1000);
e.preventDefault();
});
<ul class="menu">
<li><a href="#" data-anchor="#about">О компании</a></li>
<li><a href="#" data-anchor="#features">Услуги</a></li>
<li><a href="#" data-anchor="#calculate">Онлайн расчет</a></li>
<li><a href="#" data-anchor="#faq">Ответы на вопросы</a></li>
</ul>
<?php foreach( $mainpost as $i => $post ) { ?>
<?php if ($i == 1): ?>
<div class="row">
<?php endif; ?>
<?php if ($i == 0): ?>
<div class="col-12">
<?php else: ?>
<div class="col-8">
<?php endif; ?>
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
</div>
<div class="row">
<div class="col-12">
<?php foreach( $mainpost as $i => $post ): if ($i == 0):?>
<?php the_post_thumbnail(); break; ?>
<?php endif; endforeach; ?>
</div>
</div>
<div class="col-8">
<?php foreach( $mainpost as $i => $post ): if ($i > 0): ?>
<?php the_post_thumbnail(); ?>
<?php endif; endforeach; ?>
</div>
jQuery(function($){
$("#phone").mask("+7 (999) 999-9999");
});
// создание jQuery плагина
(function($){
var timebomb = function(){};
timebomb.prototype = {
defaults: {
time : 5, // по умолчанию время в секундах
countdown : '%COUNTDOWN% с. осталось',
prize : 'Ура!',
}
,init: function($el, opts) {
this.el = $el;
this.opts = $.extend({}, this.defaults, opts || {});
this.finish = (new Date).getTime() + 1000*this.opts.time;
this.update();
this.interval = window.setInterval( this.update.bind(this), 50);
}
,update: function() {
var toGo = Math.round( (this.finish - (new Date).getTime())/1000);
if( toGo > 0) this.el.html( this.opts.countdown.replace('%COUNTDOWN%', toGo));
else {
window.clearInterval( this.interval);
this.el.html( this.opts.prize);
}
}
};
$.fn.timebomb = function(opts) {
var tb = new timebomb();
tb.init(this, opts);
}
})( jQuery);
// применение
$('#timer-1').timebomb({
time: 6,
countdown: 'Ждите ещё %COUNTDOWN% секунд',
prize: '<button type="button" class="btn btn-success">Жми!</button>',
});
$('#timer-2').timebomb({time: 11});
<?php echo get_template_directory_uri(); ?>/images/rus.jpg