WordPress.org

Ready to get started?Download WordPress

Forums

Add adsesnse between grid style posts (2 posts)

  1. viorelepuran
    Member
    Posted 5 months ago #

    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
    Clcik here to see the file
    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;

    Here you can see how the end result should look like.
    End Result
    Thank you !

  2. esmi
    Forum Moderator
    Posted 5 months ago #

    I'm sorry but as you appear to be using a commercial theme, you need to seek support from the theme's developer/vendor. We do not support commercial products here.
    Try http://www.studiopress.com/support

Reply

You must log in to post.

About this Topic