Support » Plugins and Hacks » Default advert showing all the time

Default advert showing all the time

  • To help anyone along, I had this issue with my site where even if I had more than enough adverts and with the display of adverts set to random, that the default advert always displayed in the last slot.

    After a bit of code crunching I found that the issue seems to come from the Randomising bit in the code, where it was stopping processing the adverts at one less than the slots I had available, so then by design the code swapped in the default advert.

    I modified the code to allow for this, and even though the default advert shows up from time-to-time it is not there all the time, which was suitable for my needs.

    Anyway I hope this code is helpful to someoneā€¦

    Find the following line in wp125.php and change this

    if ($setting_ad_order == 'random') { $theorder = 'RAND() LIMIT '.$setting_num_slots ; } else { $theorder = 'slot ASC'; }

    to this (notice the ‘+ 1’ after $setting_num_slots)

    if ($setting_ad_order == 'random') { $theorder = 'RAND() LIMIT '.$setting_num_slots + 1; } else { $theorder = 'slot ASC'; }


  • The topic ‘Default advert showing all the time’ is closed to new replies.