Answer the question
In order to leave comments, you need to log in
How to make YAN ads appear after (cycle) every three posts?
Good day.
You need to do something like this, only with YAN from Yandex
. Now the following is obtained,
that is, now it is displayed only after the second post, and then the block under YAN is empty. and does not want to be displayed.
The blocks themselves are displayed like this
<?php if ( $postcounter % 6 == 2 ) : ?>
<?php get_template_part('loop', 'reklama' ); ?>
<?php endif ?>
<div class="item reklama">
<div class="wrap">
<!-- Yandex.RTB R-A-327587-1 -->
<div id="yandex_rtb_R-A-327587-1"></div>
<script type="text/javascript">
(function(w, d, n, s, t) {
w[n] = w[n] || [];
w[n].push(function() {
Ya.Context.AdvManager.render({
blockId: "R-A-327587-1",
renderTo: "yandex_rtb_R-A-327587-1",
async: true
});
});
t = d.getElementsByTagName("script")[0];
s = d.createElement("script");
s.type = "text/javascript";
s.src = "//an.yandex.ru/system/context.js";
s.async = true;
t.parentNode.insertBefore(s, t);
})(this, this.document, "yandexContextAsyncCallbacks");
</script>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question