In this article I show how the first home section's Parallax background can be replaced with rotating images with fading transition when using Parallax Pro.
Summary:
- Exclude Featured Section 1 from theme customization section.
- Exclude Home Section 1 from getting the background image CSS applied.
- Enqueue Backstretch and initialize it on Home Section 1 by providing the URLs of the rotating images.
Step 1
Edit wp-content/themes/parallax-pro/lib/customize.php.
Change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$images = apply_filters( 'parallax_images', array( '1', '3', '5' ) ); |
to
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
I am curious, is there a way to make these changes without editing the Parallax Pro theme files, in case the theme is updated?
Bill Erickson recommends using a “Site Customisations” plugin: http://www.billerickson.net/genesis-portfolio/#comment-164247
He mentions how to include new template files, though I don’t know if you can change lib/customize.php and lib/output.php in the same way.
should be possible. But like Bill says a child theme is there so you can customize it w/o worrying about updating it.
Hehe – “is there a way” was a subtle nudge asking you to demonstrate how it could be done 🙂
True, surprisingly StudioPress rarely release child theme updates but it is not unheard of. I tend to be very cautious and avoid changing child theme files.
This worked great! Thank you so much for this!
This is amazing! I’m working on my first ever WordPress site and this tutorial was very easy to follow and implement. It looks fantastic. Thank you!
Sridhar, Thanks so much for your tutorial! I used it to as a guide to turn the Agency Pro backstretch into a slideshow and it worked beautifully! Awesome!
Sabrina, what variable did you use in the ‘backstretch-init’ in place of ‘home-section-1’ to get this process to work in Agency Pro?
@Grant, Not sure if I am answering your question since, it appears that the backstretch is on all pages/posts in AgencyPro but here’s what I did.
And, unfortunately, my client decided on something different so I took down the code. But, what I remember is the following:
In the agency-pro/js/backstretch-set.js file this is the original code for Agency-Pro 3.1.1 :
jQuery(document).ready(function($) {
$("body").backstretch([BackStretchImg.src],{duration:3000,fade:750});
});
Using Step 3 in Sridhar’s example above as a guide, I changed the backstretch-set.js code to the following, (Of course, replace the http://… with the url to your images):
jQuery(document).ready(function($) {
var images = [
'http://...',
'http://...',
'http://...'
];
$('body').backstretch(images, {duration:3000,fade:1500});
});
Make sure there is no comma after the last image.
I believe that’s all that was needed to make a backstretch slideshow for Agency-Pro.
Of course always make a backup and use the code at your own risk.
Cheers.
I think this is exactly what I’m looking for. I was either going to use the Centric Pro or Parallax theme and needed that first section to be a background. Can’t wait to try it out. My current CSS is set to fixed and cover for just a stand alone background image. Which is exactly what I want except I was hoping to implement that into a slider…. One thing I’m wondering is if there is a way to implement this where the background slider is fixed and set to cover so that the next section will come up over it and yet it will fill the screen upon opening the webpage?
Thanks Sridhar! Just what I was looking for.
I have been at this for a few hours and can’t seem to make it work – I thought I followed all instructions exactly, and have gone over it several times.
One question… Where you say “Upload jquery.backstretch.min.js to js directory.” I’m assuming I’m creating a file with that name and adding the code that you link to – am I missing something in this step?
Any help ALWAYS appreciated!
Thanks.
Barbara
What you are doing sounds right. Can you post a link to the site you are working on?
Thank you! Torimacdrums.com
Hi
I have undone this, and redid it completely step by step, still can’t get it to work. Is there anything to do with the CSS? I can usually follow and get your tutorials right the first time, and this seems so straight forward, but can’t get it to work to save my life… What would the cost be for you to do it for me? This is a site for a young girl, a friend’s daughter… I’m not charging her for the site, but want her to have it look the way she wants. Please let me know. Thank you. B
Looks like you managed it? I see the slideshow at http://torimacdrums.com/.
She downloaded the Backstretch js file again. It must have been corrupted on previous downloads or uploads.
Hello,
This feature looks amazing! However I am having difficulty with step 3 and step 4. Would you be willing to give a more detailed description or post a screen cast. I know it a lot to ask but it would really help me out.
Thank you for a great tutorial but like John and Barbara the code isn’t quite working for me. I suspect it has to do with Steps 3 and 4. Here are links to the JS files:
http://80a.5f8.myftpupload.com/wp-content/themes/parallax-pro/js/jquery.backstretch.min.js
http://80a.5f8.myftpupload.com/wp-content/themes/parallax-pro/js/backstretch-init.js
Am I placing them in the correct location? Thank you for any insights!
Hi Kelli
Did you get it working? I was able to make it happen on two sites… my problem was with the backstretch.min.js – when I re-uploaded it, it finally worked… Good luck – I hope you get it working!
Yes. She has it working as can be seen from http://80a.5f8.myftpupload.com/.
Thanks for the suggestion 🙂
Thank you – its a BEAUTIFUL site!
Hi Everyone! The interesting thing is that I had to switch over to working on a different project for a few days and when I came back to work on this website the slider was suddenly working. I wonder if it wasn’t a caching issue on the hosting server. Either way it works now, thanks so much Sridhar for the great code!
Hi Sridhar
thanks for another great tutorial.
I was wondering: is there a way to make the backstretch responsive? In both versions (slider and image) the image doesn’t resize, so I can only see a portion of it (used Parallax Pro in kitchenstoriesmilano.com and event though I tried to use background-size: contain in the media queries I still see only a partial image.).
Thanks!
Francesca
Hi Francesca,
I checked the body background on the official site, http://srobbin.com/jquery-plugins/backstretch/ and it isn’t responsive. As I reduce the window width, I can see the right side getting cut off at a certain point.
And the not being responsive problem is present on the official demo site as well, http://demo.studiopress.com/parallax/.
As of now I do not know or have a solution for this.
Great tutorial, but I have one question: Is it possible to make the site header transparant and have the slider start at the top?
Thanks a lot!
Try adding http://pastebin.com/raw.php?i=b8Jrq9mm.
Further adjustments may be needed, but that should get you started.
Just used this to replace the front page 1 background area of altitude pro with a backstretch slideshow.
Thanks!
I used it on Altitude Pro also and changed “.home-section-1” to “.front-page-1” in backstretch-init.js and front-page.php. Awesome – thanks!
One question: I used the background: linear-gradient… styling that comes with Altitude Pro which really improves the look of my images. However, when the page is first loading, the unattractive gray gradient is the background until the first image loads. Do you have any suggestions on how to avoid that?
Thanks!
Can you provide the URL of the site?
Done.
http://sridharkatakam.com/full-screen-slideshow-in-altitude-pro-using-backstretch/
[…] the comments section of How to replace Home Section 1’s background image with Backstretch slideshow in Parallax Pro article, a user […]
Hi all,
I need some help. I added 3photos in slide show 1600×400, but don`t appear on the actual size, are cut.
Thanks!
Do you have a URL for us to see?
Yes, Please check your email.
Thank you!
orangewd I have checked my email but do not see anything from you.
Sorry, Maybe my email is the problem.
Here is the website link http://demo-projects.info/vgpalooza/
Please note: the pictures size are 1600×400.
Thanks!
They are appearing fine for me. Note that the images may be sized proportionately and it depends on the browser (viewport) width.
Can you show me a screenshot of the issue?
Here is the screenshotlink http://postimg.org/image/uur2w25lr/
and here the image: http://postimg.org/image/4k3s8elvh/
Thanks!
It looks fine in my 15″ rMBP: http://d.pr/i/Y4Ab
I can see the “issue” (not really, see below) when I size my browser to 2560 x 1440: http://d.pr/i/1iR4r
That is the expected behavior. When the viewport is very wide, the image will proportionately be sized and will have less height than on a screen having lesser width.
To make it “not get cut off” for displays of all sizes, you need to use images that have width at least equal to the site’s target audience’ computer screens.
I understand now.
Thank you!
Sridhar can you post a modified tutorial of this. I am using the Genesis Sample Child theme.
Thanks in advance.
Hi Sridhar, this is a great tutorial… thank you!
I am curious why nobody has asked this before (or I haven’t seen it)….
Is there a way to replicate the Altitude Pro Home Page header style in Parallax, where the background image at first is also the backaground image of the header at the top and when you scroll the header changes to a fixed/sticky format with another background color?
Thanks in advance.
Jerry