Community Forums › Forums › Design Tips and Tricks › How To Rotate Header Image In Minimum Theme?
This topic contains 15 replies, has 3 voices, and was last updated by Kevin Muldoon 5 months, 4 weeks ago.
-
AuthorPosts
-
November 21, 2012 at 11:08 pm #1249
This is a query regarding the minimum theme. I’d like to rotate the header image using a number of different images.
I’ve removed the is_home if statement from the header image function (in functions.php) so that the header image displays on the whole site.
/** Add the featured image section */
add_action( ‘genesis_after_header’, ‘minimum_featured_image’ );
function minimum_featured_image() {echo ‘<div id=”featured-image”><img src=”‘. get_stylesheet_directory_uri() . ‘/images/sample.jpg” /></div>’;
}Does anyone have the code which would enable me to rotate 3 or 4 different images. I’d rather do something simple using the function rather than using a plugin.
thanks,
Kevin
Kevin Muldoon – Blogger & WordPress Fanatic.
November 24, 2012 at 11:37 am #1489November 25, 2012 at 11:18 am #1571Your title confuses me. I think you want to have several images rotate in lieu of the single image on the ‘front page’ per the demo? This image is not in the header. If so you can…
1) Hardcode ‘Flexslider’ in a new page…front-page.php if using static pages settings. However I think you would prefer the following….
2) Create a widget area using the ‘genesis_after_header’ hook and insert a slider…ie ‘Genesis Responsive Slider’ or the ‘Soliloquy Slider‘. See Minimum functions.php for examples in adding and registering a widget.
I hope this helps!
Doak Heggeness, WordPress Development | Website
November 25, 2012 at 11:49 am #1576Hi Doak,
Thanks for replying. It’s not a slider I was looking for. If you look at the code above in the functions.php file, I only need to randomate the images that are displayed.
I managed to get it working by changing:
echo ‘<div id=”featured-image”><img src=”‘. get_stylesheet_directory_uri() . ‘/images/sample.jpg” />
to
$images[] = ‘http://www.sitecom/wp-content/themes/minimum/images/header-images/image1.jpg’;
$images[] = ‘http://www.site.com/wp-content/themes/minimum/images/header-images/image2.jpg’;
$images[] = ‘http://www.site.com/wp-content/themes/minimum/images/header-images/image3.jpg’;
$images[] = ‘http://www.site.com/wp-content/themes/minimum/images/header-images/image4.jpg’;
echo ‘<div id=”featured-image”><img src=”‘.$images[rand(0,count($images)-1)].’” /></div>’;
Kevin Muldoon – Blogger & WordPress Fanatic.
-
This reply was modified 5 months, 4 weeks ago by
Kevin Muldoon.
-
This reply was modified 5 months, 4 weeks ago by
Kevin Muldoon.
November 25, 2012 at 12:06 pm #1579If you would consider having a different random image every time the home page is loaded, rather than timed rotating/sliding/fading images, you can easily integrate and use Matt Mullenweg’s random image script here - http://ma.tt/scripts/randomimage/ . I have used it a couple of times with Minimum 2.0 and it works fine.
I like the random option it because it does not slow the page down any from how it is “out-of-the-box” yet offers a different image each time the page is visited.
Resultz Digital | Websites, search marketing services and consulting for small business.
Use the Custom Genesis Framework for WordPress Resource Search EngineNovember 25, 2012 at 12:10 pm #1580Hi Marc,
That was actually the first script I tried as I used it in the past. For some reason, I couldn’t get it to work. Not sure what I done wrong.
Kevin
Kevin Muldoon – Blogger & WordPress Fanatic.
November 25, 2012 at 12:16 pm #1583Kevin, seems like I “stepped” on your reply above. Either method will get you there. I like Matt’s because I don’t have to worry about any image names or conventions, just ftp them (whatever they are named) into the dedicated folder.
November 25, 2012 at 12:19 pm #1584I may try the script again if you have got it working. When I tried it last time it gave me a fatal error. I assumed it was because the script was so old and a new version of PHP clashes with it.
Kevin Muldoon – Blogger & WordPress Fanatic.
November 25, 2012 at 12:22 pm #1585Congrats on your success. I am glad there are alternatives, if I need. Thank you!
Script conflicts arise. I have Matt’s script running on this site -
And on my local server with another site and RC3.5 + Minimum 2.0
But you can never tell ….
November 25, 2012 at 12:30 pm #1586FWIW, Below is the modified function code related to Matt’s script from the site linked above. (Note: Matt’s script name is changed) -
/** Add the featured image section */
add_action( ‘genesis_after_header’, ‘minimum_featured_image’ );
function minimum_featured_image() {
if ( is_home() ) {
echo ‘<div id=”featured-image”><img src=”‘. get_stylesheet_directory_uri() . ‘/images/header-images/minimum-header-rotate.php” alt=”College Station and Bryan TX event and wedding photography” title=”College Station and Bryan TX event and wedding photography” /></div>’;
}
/** elseif ( is_singular( array( ‘post’, ‘page’ ) ) && has_post_thumbnail() ){
echo ‘<div id=”featured-image”>’;
echo get_the_post_thumbnail($thumbnail->ID, ‘header’);
echo ‘</div>’;
} */
}
Resultz Digital | Websites, search marketing services and consulting for small business.
Use the Custom Genesis Framework for WordPress Resource Search Engine-
This reply was modified 5 months, 4 weeks ago by
Marc.
-
This reply was modified 5 months, 4 weeks ago by
Marc.
November 25, 2012 at 12:33 pm #1588Thanks Marc. Really appreciate that. Just to check, are you using the rotate script found on this page (from 2003).
http://ma.tt/scripts/randomimage/
Kevin Muldoon – Blogger & WordPress Fanatic.
November 25, 2012 at 1:05 pm #1592Yes, exactly. The only deviation is to name the script “minimum-header-rotate.php”
November 25, 2012 at 1:39 pm #1600November 25, 2012 at 2:16 pm #1608Kevin, Email me at info@resultzdigital.com and I will provide you site login credentials to the photographer’s site if you want to explore differences as to why it is working there and not on yours.
Resultz Digital | Websites, search marketing services and consulting for small business.
Use the Custom Genesis Framework for WordPress Resource Search Engine-
This reply was modified 5 months, 4 weeks ago by
Marc.
-
This reply was modified 5 months, 4 weeks ago by
Marc.
November 25, 2012 at 3:34 pm #1626 -
This reply was modified 5 months, 4 weeks ago by
-
AuthorPosts
The topic ‘How To Rotate Header Image In Minimum Theme?’ is closed to new replies.