Default advert showing all the time (1 post)

  1. paul@effigy.com.au
    Posted 1 year ago #

    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'; }


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP125
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by paul@effigy.com.au
  • This topic is not resolved
  • WordPress version: 3.7.1