Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

[SOLVED] Random Header Image


  #1  
Old Mar 21, 2013, 07:40 AM
bevanda
 
4 posts · Mar 2013
Hi,

I'm using the Montezuma theme, but i really wanted to have a banner. So I have this on my header.php:
Quote:
<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">
</a>
</div>
It works pretty well. But I wanted to put my other images. I searched a bit on google and i found this

Code:
<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
  #2  
Old Mar 21, 2013, 08:33 AM
jerryc
 
367 posts · Oct 2012
Florida
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 10:16 PM.
  #3  
Old Mar 21, 2013, 10:18 AM
juggledad's Avatar
juggledad
 
23,765 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
  #4  
Old Mar 22, 2013, 02:47 AM
bevanda
 
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 02:54 AM.

Bookmarks

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 06:51 PM
Random Header? garnpet Header configuration & styling 1 Jun 11, 2010 03:36 AM
Use random image code to display random flash banner? blueprairie Header configuration & styling 0 Mar 18, 2010 01:30 PM
[SOLVED] Random first image bignall Header configuration & styling 2 Dec 14, 2009 07:37 PM


All times are GMT -6. The time now is 01:09 AM.


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