Results 1 to 1 of 1
Like Tree1Likes
  • 1 Post By ralmoor

Thread: [Tutorial] Adsense Between Search Listings

  1. #1
    Thread Starter
    ralmoor's Avatar
    Join Date
    Feb 2013
    Location
    United States
    Posts
    88
    Thanks
    3
    Thanked 4 Times in 3 Posts

    [Tutorial] Adsense Between Search Listings

    I have gotten some great help from users in this forum so I thought I would share this tip.

    1. Move archive-listing.php to your child theme.
    2. Find <?php while (have_posts()) : the_post(); ?>
    3. Replace with:

    PHP Code:
    <?php
    /* 
    Key = Position of the Ad
    Value = The AdSense Banner Code
    */
    $advertisements = array('3' => '<!-- adsense ad code 1 here -->',
                                    
    '6' => '<!-- adsense ad code 2 here -->',
                                    
    '9' => '<!-- adsense ad code 3 here -->');

    $i 1;

    while (
    have_posts()) : the_post();
    ?>
    4. No find <?php endwhile; ?>
    5. Replace with:

    PHP Code:
    <?php
    if(array_key_exists($i$advertisements)) {

    // you can add custom HTML code here
    echo $advertisements[$i];
    }

    $i++;

    endwhile;
    ?>
    6. Replace <!-- adsense ad code 1 here --> in all three spots with your ad code. Make sure to put your code between the ' ' Now your ads will show on the search listings page.
    fgodd likes this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Tutorial: Featured listings in search results.
    By johno69 in forum Vantage General Discussion (Legacy)
    Replies: 28
    Last Post: July 6th, 2023, 11:53 AM
  2. [TUTORIAL] Tutorial - ClassiPress Listings Update Subscription With Subscribe2 Plugin
    By palent in forum ClassiPress General Discussion
    Replies: 8
    Last Post: December 1st, 2013, 04:01 PM
  3. Tutorial: Display limited content for free listings, lots for Featured
    By johno69 in forum Vantage General Discussion (Legacy)
    Replies: 9
    Last Post: December 19th, 2012, 05:31 PM
  4. Tutorial - E-mail Support (E-mailing Job Listings to Subscribers)
    By pilotjobupdate in forum JobRoller General Discussion
    Replies: 3
    Last Post: July 25th, 2012, 04:52 PM
  5. [TUTORIAL] WP Custom Search messing up Google Adsense on search pages
    By mlanghorst in forum ClassiPress General Discussion
    Replies: 1
    Last Post: August 8th, 2010, 08:38 PM