Display random banners easily, random banners widget, banners before or after post content automatically, banners between post content, custom place, unlimited banners!

WordPress Random Banners Features

  1. Easy to use.
  2. Random banners widget.
  3. Random banners before post content, or after post content, or before and after post content automatically.
  4. Random banners between post content (shortcode).
  5. Random banners in custom place.
  6. Unlimited random banners.
  7. Compatible with SEO.
  8. Compatible with any wordpress theme, no need to customize CSS.
  9. WordPress filters ready (to add custom wrap).
  10. Soon will be multi languages, contact me for translation.

WordPress Random Banners Demo

Look to “Premium WordPress Items” widget in my sidebar and refresh the page to change banner.

And this shortcode demo, refresh the page to change banner:

WordPress Random Banners Widget

Go to Appearance menu > Widgets, now drag and drop “Random Banners” widget to your sidebar.
Now in “Banners” field, enter your banners links, one URL per line, and in “Links” field, enter your links in the same order, one URL per line.
For example about same order:

wordpress random banners widget

Random Banners For Post Content

Go to Plugins menu > Random Banners.
In “Post Content Banners” section, you will find “Banners” field, enter your banners links, one URL per line, and in “Links” field, enter your links in the same order, one URL per line.

wordpress random banners settings

In “Display Banners” options, choose banners position, default is “Before post content automatically”.

wordpress random banners position

In “Banners Align” choose banner align, default is “none”.

wordpress random banners align

Screen And Exclude Options

wordpress random banners screen

This option “Display banners in single post only” to display random banners in single post, single page, single custom post type.

This option “Display banners in index pages only” to display random banners in index pages only, like home page, category page, search page, front page, etc.

This option “Display banners in single post and index pages” to display random banners in single post and index pages.

When choosing “in index pages” or “in single post and index pages”, you can exclude some pages, for example:

wordpress random banners exclude

Note:
To exclude custom post type, enter post type name in “Exclude custom post type” field, if two or more, enter space between name, for example “movies sport”.
Exclude options not working with “Custom Place Banners”, we will explain these in the end of the article.

WordPress Random Banners Shortcode

To display random banners between post content,
use this shortcode: [obi_random_banners]

Shortcode Attributes

align=””, enter “center” or “left” or “right” or “none”, default is “none”.
screen=””, enter “index” or “all” or “single”, default is “single”.
If choosing “single” will be display banners between post content in single post or single page, etc.
If choosing “index” will be display banners between post content in index pages only, like home page, category page, etc.
If choosing “all” will be display banners between post content in index pages and in single post, etc.
For example:
[obi_random_banners align=”center” screen=”index”]
Now will be display random banners in index pages only and banners will be center align.
Note: Exclude options is working with this shortcode.

Custom Place Banners

wordpress random banners custom place

In “Banners” field, enter your banners links, one URL per line, and in “Links” field, enter your links in the same order, one URL per line.

Usage Custom Place

Now go to your custom place, for example in header.php file or footer.php file, etc, and use this code:

<?php
$banners = get_option("alobaidi_rbp_custom_banners");
$links = get_option("alobaidi_rbp_custom_links");
echo alobaidi_random_banners( $banners, $links, null );
?>

More Of Custom Place

Go to your custom place, and use like this code for every custom place:

<?php
$banners = 'http://example.com/facebook-banner.png http://example.com/google-banner.png';
$links = 'http://facebook.com http://google.com';
echo alobaidi_random_banners( $banners, $links, null );
?>

This $banners is your banners links, enter your banners links with space or line between banners links:
$banners = ‘http://example.com/facebook-banner.png http://example.com/google-banner.png’;
And this $links is your links, enter your links with space or line between links and in the same order.
$links = ‘http://facebook.com http://google.com’;

Exclude Page With Custom Place

Use wordpress conditional tags, for example:

<?php
$banners = 'http://example.com/facebook-banner.png http://example.com/google-banner.png';
$links = 'http://facebook.com http://google.com';
if( is_home() ){
echo alobaidi_random_banners( $banners, $links, null );
} ?>

Now your custom place banners will be display in home page only.

Custom Wrap Filters

To add custom wrap for post content random banners and shortcode, copy this code and paste it in your functions.php file:


function random_banners_shortcode_custom_wrap_before(){
return '
<div class="my_custom_wrap">';
}
add_filter('alobaidi_random_banners_shortcode_wrap_filter_before', 'random_banners_shortcode_custom_wrap_before');
function random_banners_shortcode_custom_wrap_after(){
return '</div>

';
}
add_filter('alobaidi_random_banners_shortcode_wrap_filter_after', 'random_banners_shortcode_custom_wrap_after');

To add custom wrap for random banners widget:


function random_banners_widget_custom_wrap_before(){
return '
<div class="my_custom_wrap">';
}
add_filter('alobaidi_random_banners_widget_wrap_filter_before', 'random_banners_widget_custom_wrap_before');
function random_banners_widget_custom_wrap_after(){
return '</div>

';
}
add_filter('alobaidi_random_banners_widget_wrap_filter_after', 'random_banners_widget_custom_wrap_after');

FAQ

Q. In “Display Banners” options, I choosed “Display banners in index pages only”, but random banners shortcode between post content not showing my banners in single post! Why?
A. Use screen=”single” in your shortcode, for example: [obi_random_banners screen=”single”].

Q. Can I use multi size, for example banners size 300×250 and 720×92 and 468×60, etc.
A. Yeah! sure, any size.

Q. I have 3 affiliate banners and 1 affiliate link, how to add 1 link with 3 banners?
A. In “Banners” field, enter your banners links, and in “Links” field, enter your link 3 times, like this:

wordpress random banners

Q. I do not want post content random banners, I want random banners widget only, how?
A. In “Display Banners” options, choose “Disable post content banners”, now use random banners widget or use random banners shortcode between post content.

disable wordpress random banners

Q. I want to display random banners in home page only without other pages, how?
A. In “Display Banners” options, choose “Display banners in index pages only”, and exclude all pages, like this:

wordpress random banners homepage only

Download Plugin

Don’t forget! if you like wordpress random banners plugin, please rate it.