• I’m struggling with Adsense codes between posts. First, look the image:

    IMAGE

    I have a grid of 12 posts in homepage, each row being 3 posts. How could i put Adsense ad on the second post of the first row, then another Adsense code (it’s the same size of container) afer the second row os posts, and, then another Adsese ad at the 11th post.

    I know it’s possible but i’m real struggling with that.

    INDEX.PHP LOOP:

    <?php if ( have_posts() ) : ?>
    
                <?php /* Start the Loop */ ?>
    
                <?php while ( have_posts() ) : the_post(); ?>
    
                    <?php get_template_part( 'content', get_post_format() ); ?>
    
                <?php endwhile; ?>
    
                <?php hct_content_nav( 'nav-below' ); ?>
    
            <?php else : ?>
    
                <article id="post-0" class="post no-results not-found">
                    <header class="entry-header">
                        <h1 class="entry-title"><?php _e( 'Nothing Found', 'hct' ); ?></h1>
                    </header><!-- .entry-header -->
    
                    <div class="entry-content">
                        <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'hct' ); ?></p>
                        <?php get_search_form(); ?>
                    </div><!-- .entry-content -->
                </article><!-- #post-0 -->
    
            <?php endif; ?>
    
            </div><!-- #content -->

    CONTENT.PHP LOOP (CALLED BY INDEX.PHP)

    <?php
        $count = $wp_query->current_post;
        $c     = fmod($count,3);
        if ($c == '2') : ?>
        <div style="clear:both;"></div>
    <?php endif;?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Landowski

    (@landowski)

    Please, i just need a way to post an ad at specific places. I do know that is there a way to alter that php counter above to display ads at specific places, bu t i dont know how i do it. When i put a code from a example, the ad shows but, its not a post, then the counter break the line at the count of 3. But, with a ad in the middle of row 1, the count breaks at the third, leaving me with the layout: ROW 1: POST AD POST ROW 2: POST (ALONE) —- COUNTER BREAKS AT THIRD — ROW 3: POST POST POST

    Hi, looking for the same thing, have you find an answer yet?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adsense between a grid loop of posts?’ is closed to new replies.