Random Feature Image

Support Area Forums Bottega Random Feature Image

Viewing 4 posts - 1 through 4 (of 4 total)
URL to the page in question: http://dev.icoptique.com/sample-page/
  • Author
    Posts
  • #36124
    Avatar photoBuruko
    Participant

    This may be reaching but I’m at ends with it.

    So on this page I have a ‘featured image’ on the page (below the black line) that is just a mirror of the header background. What I want to do is actually have a folder full of images pre-sized to be used as ‘featured images’ on all pages.

    So that basically the images rotate or change. I want this on all pages so that the ‘featured images’ don’t stay static on each page.

    I found various descriptions for doing this on the header but not with the featured image, I figured this would require altering the various templates in a child theme to accomplish.

    If you could even point me in a direction it would be appreciated.

    #36126
    Bill Robbins
    Moderator

    Good question. It is possible to do that, but you will need to replace the featured image functionality with something more custom. Here’s a snippet that I used creating a child theme for a hospital that was using the Foundation theme.


    (See support site for snippet)

    In the child theme, we created a folder called images and placed the seven banner images there. Then this snippet was added to the header.php file in the child theme. It uses javascript to randomly load one of the images into the new div with the id of “banner-image.” I used javascript instead of php so that the customer could still use caching while not losing the random images.

    In Bottega, you could copy the layouts/post-formats.php file over to your child theme. That’s the file where the featured image is set in Bottega. If you’re not ever going to use the video, slideshow or featured images there, then you could replace all the code there with the snippet above. If you’d like to preserve that ability, then you could set the random images as a fallback. That would look something like this:

    That’s one possibility at least. I haven’t tested this in Bottega, but that’s where I’d start.

    Have a great weekend,
    Bill

    #36129
    Avatar photoBuruko
    Participant

    Thank you! Thank you! Thank you!

    I’ll get to tinkering right away.

    #36133
    Bill Robbins
    Moderator

    Anytime 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Random Feature Image’ is closed to new replies.