Archive for April, 2010

Rotating Images in a WordPress Theme

Monday, April 19th, 2010

Sometimes you want to add a little pizazz to your page and having images rotate each time someone visits your site is an easy way to do that. How can we get this done with the greatest ease?

Let’s say you have a place on your sidebar where you want to have an image appear. Then let’s say you have five different images that you would like to choose from each time the page is loaded. Then let’s say even further that you want the images to appear randomly.

So cutting to the quick, here is the code we can use to get this done:

$r_num = rand(1,5);
$selected_image = "image_" . $r_num . ".jpg";

the second number above
is the number of images
you want to rotate

<img src="<?php bloginfo('template_url'); ?>
/images/<?php echo $selected_image; ?>"
alt="Random image...hit refresh to change!" />

For this to work properly the theme you are using must have a directory named “images” and that directory must contain your five files.  Those files must be named image_1.jpg, image_2.jpg, image_3.jpg, image_4.jpg and image_5.jpg.

Figuring out where to put the code might be a little confusing,  so you may have to experiment with it.  But if you wanted the image to appear at the top of the sidebar, then paste the code on the first few lines of the sidebar.php file.  If you want the image to appear in the header, then paste the code in the header.php file somewhere after the <body> element.  Play with it a little until you get the images to come up where you want them.

Page Order in WordPress

Monday, April 19th, 2010

Yes, a frustrating thing about using WordPress, especially when you are not a very experienced user, is trying to get the Pages to show up in a list in the order that you want, just as in a menu. If you read the documentation pages over at you can learn how to do it, but it might be a tab bit confusing. The easy way is to get the My Page Order plugin. You can find it at It allows you to put your Pages (not your Posts, but your “Pages”) in the order you would like. Just download, install, and activate it. Be sure to get the latest version because it has some extras on it that earlier versions did not have.

While you are at it, you may as well grab the My Links Order plugin as well at It does the same thing for your links and links categories. Must easier than reading the documentation.

Develop on Your Laptop First

Sunday, April 18th, 2010

When attempting to create a website using software, such as WordPress, or creating an HTML or PHP site from scratch, it is often helpful to develop the site first on your laptop (or your desktop if you still live in the stone age…like me) and then transfer it when you get it ready for production. Using this approach cuts down on ftp time and waiting for network glitches. It also enables you to develop wherever you are even if no wi-fi is handy. No matter what OS you use you can grab a copy of xampp and make life much easier for yourself. One place to get it is at the web site. If is free and all the apps on it are open source, which is the way things were meant to be.

Clarity Trumps all Else

Sunday, April 18th, 2010

When we study pedagogy we look at many different variables that contribute to creating the type of classroom that will be conducive to leaning. We look at credibility, immediacy, climate, humor, and so on, but clarity emerges as the most important feature for a teacher to possess. If students do not understand what you are saying, then forgetaboutit.

WordPress Plugin that Enables Linking to Places Other than your Blog

Sunday, April 18th, 2010

Let’s say that you want to create a link that will “go off” your WordPress site.  For example, you want a link to the University of Louisville main page, which is but your Word Press blog is located at  This type of linking can sometimes be a little tricky with most themes, so get the plugin named Page Links To. It is very easy to install and use and it allows you to create off-site links.