• Hi

    This question has been asked many times, but don’t work for the Tarski theme which doesnt use the common loop.

    I’d like to place an ad after every kth post. Now i am not sure whether I should be looking at index.php or archives.php
    It’s gotta work when I click on the links under my categories links.

    Here is archives.php
    http://pastebin.com/HkjvgFsU

    index.php
    http://pastebin.com/EiGTngT9

    Can you figure this out?

Viewing 4 replies - 1 through 4 (of 4 total)
  • this line:
    <?php get_template_part('app/templates/loop'); ?>
    points to a template loop.php in the /app/templates/ sub-folder

    locate that file and post the code into a pastebin – or better, edit it to insert the ads.

    Thread Starter psukop

    (@psukop)

    Alchymyth

    Thanks for looking at it. Here is loop.php

    http://pastebin.com/mJPMHCNU

    I’d like to insert adsense every “k”th post in my category posts.
    How to get it to work?

    Thanks

    http://pastebin.com/Cd0i9gpm

    the edit is very close to the end:

    replaced:

    <?php } } // End entry loop ?>

    with:

    <?php }
    
         $k = 5; // set the $k value //
         if( ($wp_query->current_post+1)%$k == 0 && $wp_query->current_post <= 3*$k ) { ?>
         ADSENSE CODE
         <?php }
    
    } // End entry loop ?>
    Thread Starter psukop

    (@psukop)

    Hi Alchymyth

    Thanks that that code that inserts an ad every 5th entry. The ads appeared as if by magic. Delighted. You are very kind to share your time and knowledge like this. I am touched. Thought no one on the internet would help in this way.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to insert ads between every kth post using Tarski theme’ is closed to new replies.