How To Rotate Header Image In Minimum Theme?

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

This topic is: resolved

This topic contains 15 replies, has 3 voices, and was last updated by  Kevin Muldoon 1 year, 4 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1249

    Kevin Muldoon
    Participant
    Post count: 16

    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.

    #1489

    Kevin Muldoon
    Participant
    Post count: 16

    Anyone know how this can be done?


    Kevin Muldoon – Blogger & WordPress Fanatic.

    #1571

    Doak Heggeness
    Participant
    Post count: 140

    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

    #1576

    Kevin Muldoon
    Participant
    Post count: 16

    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.

    • This reply was modified 1 year, 4 months ago by  Kevin Muldoon.
    • This reply was modified 1 year, 4 months ago by  Kevin Muldoon.
    #1579

    Marc
    Moderator
    Post count: 175

    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.


    • This reply was modified 1 year, 4 months ago by  Marc.
    • This reply was modified 1 year, 4 months ago by  Marc.
    • This reply was modified 1 year, 4 months ago by  Marc.
    • This reply was modified 1 year, 4 months ago by  Marc.
    #1580

    Kevin Muldoon
    Participant
    Post count: 16

    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.

    #1583

    Marc
    Moderator
    Post count: 175

    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.


    #1584

    Kevin Muldoon
    Participant
    Post count: 16

    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.

    #1585

    Marc
    Moderator
    Post count: 175

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

     


    #1586

    Marc
    Moderator
    Post count: 175

    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>’;
    } */
    }


    • This reply was modified 1 year, 4 months ago by  Marc.
    • This reply was modified 1 year, 4 months ago by  Marc.
    #1588

    Kevin Muldoon
    Participant
    Post count: 16

    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.

    #1592

    Marc
    Moderator
    Post count: 175
    #1600

    Kevin Muldoon
    Participant
    Post count: 16

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


    Kevin Muldoon – Blogger & WordPress Fanatic.

    #1608

    Marc
    Moderator
    Post count: 175

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


    • This reply was modified 1 year, 4 months ago by  Marc.
    • This reply was modified 1 year, 4 months ago by  Marc.
    #1626

    Kevin Muldoon
    Participant
    Post count: 16

    Thanks Marc. Sent you a quick email :)


    Kevin Muldoon – Blogger & WordPress Fanatic.

Viewing 15 posts - 1 through 15 (of 16 total)

The topic ‘How To Rotate Header Image In Minimum Theme?’ is closed to new replies.