Banners: Hardcoded

You can hardcode banner ads directly into your WordPress theme files using the WordPress Banner Rotator plugin. Before you hardcode banner ads into your theme, you’ll need to initialize the wpBanners object like shown below.

Initialize the wpBanners object

With the wpBanners object initialized and available to your use, you may start hardcoding banner ads. There are three ways of hardcoding ads. You can either hardcode an ad directly with its “id” value, hardcode an ad by its “size_id” value or hardcode an ad by its “zone_id” value. There is a respective function/method for each of these.

Hardcode by ID

Change the value “7” to the ID value of any ad you wish to display.

Hardcode by Size

Change the value “4” to the ID value of any size of which you wish to display an ad.

Hardcode by Zone

Change the value  “2” to the ID value of any zone of which you wish to display an ad.

Hardcode by Size and Zone

Change the value “2” to the ID value of any size record and the value “3” to the ID value of any zone record from which you wish to display ads.

For each of the functions/methods of the wpBanners object displayed above, the first parameter passed to the function/method is the ID value of either the ad, size or zone. The second parameter tells the plugin whether the ad/banner should be output/echoed or not. If the second parameter is set to “true”, the ad will be displayed and you don’t have to print or echo it yourself. If you set it to “false”, you can put the resulting ad into a variable and echo it yourself if needed.

Please note that al hardcoded ads still need to pass a conditional test which checks whether the ad is active, its impressions is either set to unlimited or it is smaller than the total views and its expiry date is set to “0000-00-00” or it is later than the current date.

Beautiful Newsletter Templates

Professional newsletter templates that are fully responsive for desktop, tablet, and mobile. They are 100% cross-client compatible.

See Them

Pin It on Pinterest