• Hello guys,
    I am using a child theme with genesis, and i created a category.php to display post in grid layout.
    So now, my post are beeing displayed on 2 columns.
    Now i want to add a adsense ad after the first 6 posts.
    So it needs to be 6 posts, and after those 6 posts, a area as width as the 2 column post, containing the AD.
    Here is the file for category, in pastebin
    http://pastebin.com/wxzBMUpt
    I think it needs some tweeks on line 13 , but i do not know how to do it.
    Can someone help me with it?
    I saw a example from someone, but i think it is not for grid style.Here it is:

    Ah! Now I understand. Try replacing:

    <?php
    if (have_posts()) : while (have_posts()) : the_post();
    get_template_part(‘post’, ‘homepage’);
    endwhile;
    with:

    <?php
    if (have_posts()) : $c = 0; while (have_posts()) : the_post();
    $c ++;
    get_template_part(‘post’, ‘homepage’);
    if ($c > 2 ) {
    $c = 0;?>
    [ insert ad code here ]
    <?php
    }
    endwhile;

    Thank you !

Vizualizare 1 răspuns (din 1 în total)
  • Poti face 2 query-uri separate. Primul query il faci in ultimele 6 posturi. Dupa acest query vii cu codul pentru adsense. Iar dupa cod inca un query pe ultimele 12 posturi si un offset de 6.

Vizualizare 1 răspuns (din 1 în total)
  • Subiectul „Add adsesnse between grid style posts” este închis pentru răspunsuri noi.