Hi,
i am working on the new format of adsense adds.
Since 1 year, it's possible to add "Infeed Ad"
you can have several times one ad in a page.
So i am trying to add the code ad every 5 items in my page.
Google explain how to implement this function with the code below
on this page
:
Posts[] posts;
count Var = 1; // Si votre code ne comprend pas de compteur, veuillez en définir un.
While (count < posts.length) // Ajoutez 1 à la valeur de "count" jusqu'à atteindre le dernier élément dans la base de données.
{
If (count%3=0) // Si la valeur de "count" est égale à 3, 6 ou 9, insérez l'annonce.
{
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>
<ins class="adsbygoogle" style="display:block"
data-ad-format="fluid"
data-ad-client="ca-pub-1234567891234567"
data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
}
<h3>{{ post.title }}</h3> // Pour toutes les valeurs de "count", insérez le titre du bloc de contenu.
<p>{{ post.body }}<p> // Insérez le corps du bloc de contenu.
<img src="{{ post.thumbnail}}"> // Insérez l'image du bloc de contenu.
}
i use the template " Tab / slider item placement"
i tried to add the code in "category_items.php" file.
But i can't understand how to implement this with php foreach function?