Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

[SOLVED] Random Header Image

Old Mar 21, 2013, 08:40 AM
4 posts · Mar 2013

I'm using the Montezuma theme, but i really wanted to have a banner. So I have this on my header.php:
<div id="logo-img" class="col12 row">
<a href="http://aasfansub.fr">
<img src="http://aasfansub.fr/wp-content/themes/montezuma/images/headerimage_3.jpg">
It works pretty well. But I wanted to put my other images. I searched a bit on google and i found this

<img src="http://aasfansub.fr/wp-content/themes/montezuma/images/headerimage_<?php echo(rand(1,3)); ?>.jpg"
width="image_width" height="image_height" />
So i have my 3 img on my folder, named headerimage_1 / headerimage_2 /headerimage_3.jpg

But it doesnt work at all... help me please
Old Mar 21, 2013, 09:33 AM
367 posts · Oct 2012
You'll probably need at least one plugin to do random images. I use two. Here's how I did it.

Edit: I just looked more closely at your code. It's pretty simple and you should be able to do what you're trying to with only the PHP Code Widget Plugin. How to use it with MZ is described more fully in this post.

Last edited by jerryc; Mar 21, 2013 at 11:16 PM.
Old Mar 21, 2013, 11:18 AM
juggledad's Avatar
23,682 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
You are limited in the php that you can use in the virtual templates (due to WordPress restrictions) so you'll need to a widget area (see the 'Limited PHP Code' - Dynamic sidebar) in place of your image and then you can follow Jerry's suggestion to add a plugin to handle the images - I'd try a couple and then you can pick the one you like.
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
Old Mar 22, 2013, 03:47 AM
4 posts · Mar 2013
Thx to you two. I tried what JerryC said with only the php plugin. Right now its working well, thx again !

Last edited by bevanda; Mar 22, 2013 at 03:54 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Rotating Header Image with Javascript Sven New Versions, & Updating 31 Nov 14, 2010 07:51 PM
Random Header? garnpet Header configuration & styling 1 Jun 11, 2010 04:36 AM
Use random image code to display random flash banner? blueprairie Header configuration & styling 0 Mar 18, 2010 02:30 PM
[SOLVED] Random first image bignall Header configuration & styling 2 Dec 14, 2009 08:37 PM

All times are GMT -6. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.