• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How To Rotate Header Image In Minimum Theme?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How To Rotate Header Image In Minimum Theme?

This topic is: resolved

Tagged: header, image, minimum, rotate

  • This topic has 15 replies, 3 voices, and was last updated 10 years, 3 months ago by Kevin Muldoon.
Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • November 21, 2012 at 11:08 pm #1249
    Kevin Muldoon
    Member

    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 #1489
    Kevin Muldoon
    Member

    Anyone know how this can be done?


    Kevin Muldoon – Blogger & WordPress Fanatic.

    November 25, 2012 at 11:18 am #1571
    Doak Heggeness
    Member

    Your 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 #1576
    Kevin Muldoon
    Member

    Hi 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.

    November 25, 2012 at 12:06 pm #1579
    Marc
    Participant

    If 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.

    November 25, 2012 at 12:10 pm #1580
    Kevin Muldoon
    Member

    Hi 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 #1583
    Marc
    Participant

    Kevin, 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.


    Resultz Digital | Websites, search marketing services and consulting for small business.

    November 25, 2012 at 12:19 pm #1584
    Kevin Muldoon
    Member

    I 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 #1585
    Marc
    Participant

    Congrats 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 -

    http://dennisgrimesphoto.com

    And on my local server with another site and RC3.5 + Minimum 2.0

    But you can never tell ....

     


    Resultz Digital | Websites, search marketing services and consulting for small business.

    November 25, 2012 at 12:30 pm #1586
    Marc
    Participant

    FWIW, 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.

    November 25, 2012 at 12:33 pm #1588
    Kevin Muldoon
    Member

    Thanks 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 #1592
    Marc
    Participant

    Yes, exactly.  The only deviation is to name the script "minimum-header-rotate.php"


    Resultz Digital | Websites, search marketing services and consulting for small business.

    November 25, 2012 at 1:39 pm #1600
    Kevin Muldoon
    Member

    Not sure why but it's giving me the same error.


    Kevin Muldoon – Blogger & WordPress Fanatic.

    November 25, 2012 at 2:16 pm #1608
    Marc
    Participant

    Kevin, Email me at [email protected] 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.

    November 25, 2012 at 3:34 pm #1626
    Kevin Muldoon
    Member

    Thanks Marc. Sent you a quick email 🙂


    Kevin Muldoon – Blogger & WordPress Fanatic.

    November 25, 2012 at 5:34 pm #1641
    Kevin Muldoon
    Member

    Thanks for your help Marc. The file you sent me worked. I must have copied the wrong code somewhere.

    Feel free to close the thread now:)


    Kevin Muldoon – Blogger & WordPress Fanatic.

  • Author
    Posts
Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘How To Rotate Header Image In Minimum Theme?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble