This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

Remus

  • ***
  • 45 posts
How to display adsense after every 3 ads on search?
« on: August 10, 2023, 08:09:36 AM »
Hello, how can i add adsense after every 3 ads on search page.
Now is displayed first, third and last on search page... thanks

*

MB Themes

Re: How to display adsense after every 3 ads on search?
« Reply #1 on: August 10, 2023, 02:39:05 PM »
You need to create PHP condition to do it.
Something like:

Code: [Select]
<?php
$i 
0;

while(
osc_has_items()) {
  ... 

  if(
$i%== 0) { 
    
?>

      <script>somejavascriptadsensehere</script>
    <?php
  
}

  ...

  
$i++;
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Remus

  • ***
  • 45 posts
Re: How to display adsense after every 3 ads on search?
« Reply #2 on: August 16, 2023, 06:49:06 AM »
You need to create PHP condition to do it.
Something like:

Code: [Select]
<?php
$i 
0;

while(
osc_has_items()) {
  ... 

  if(
$i%== 0) { 
    
?>

      <script>somejavascriptadsensehere</script>
    <?php
  
}

  ...

  
$i++;
}

Hello nd where to ads this in search.php?
Thanks

Marked as best answer by www.anunturi1.ro on August 21, 2023, 10:19:23 PM
*

mwindey

  • *****
  • 478 posts
Re: How to display adsense after every 3 ads on search?
« Reply #3 on: August 16, 2023, 12:48:10 PM »
@Remus,

Simply replace this part:

Code: [Select]
              if($c == 3 && osc_count_items() > 3) {
                echo eps_banner('search_middle');
              }

With this part:

Code: [Select]
              if($c%3 == 0 && osc_count_items() > 3) {
                echo eps_banner('search_middle');
              }
« Last Edit: August 20, 2023, 01:51:25 PM by mwindey »

*

Vineet Singh

  • **
  • 9 posts
Re: How to display adsense after every 3 ads on search?
« Reply #4 on: November 18, 2023, 09:09:02 AM »
This shows AdSense in web version but does not display ads in mobile version. can you please help us with that as well. 

*

MB Themes

Re: How to display adsense after every 3 ads on search?
« Reply #5 on: November 19, 2023, 03:15:06 PM »
No difference in code. Make sure banner boxes are not hidden on mobile.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vineet Singh

  • **
  • 9 posts
Re: How to display adsense after every 3 ads on search?
« Reply #6 on: November 20, 2023, 06:31:49 PM »
Thank you so much.