Saturday, May 14, 2011

Random Image Banners in Wordpress

There are lots of different ways to get this done, either by using one of many Wordpress plugins, or just writing custom code. But for this tutorial, we'll be using a Wordpress plugin called WP Bannerize.

  1. Download the plugin from this page. Extract and upload to your server, location should be your_wordpress_directory_root/wp-content/plugins.

  2. Login to your blog, and on your left sidebar, click on Plugins. Look for WP Bannerize, and click Activate to enable the use of the plugin.

  3. Once the plugin is activated, you should be able to see on your admin sidebar the WP Bannerize controls. You can now start adding banners by clicking on "Add new".

  4. Browse for the image, and fill out other attributes like destination URL, etc.

  5. Now that you have your banners ready, you need to insert into your theme the following:

    <?php if(function_exists( 'wp_bannerize' )) wp_bannerize('limit=1&random=1'); ?>

    Note:

    The default code would just be:

    <?php if(function_exists( 'wp_bannerize' )) wp_bannerize(); ?>

    but adding limit and random makes your banners appear in random order.

1 comment:

Anonymous said...

What words..