Community Forums › Forums › Archived Forums › Design Tips and Tricks › Altitude Pro not working with CDN
Tagged: Altutide Pro
- This topic has 2 replies, 2 voices, and was last updated 8 years, 1 month ago by fw190.
-
AuthorPosts
-
March 16, 2016 at 8:20 am #181549fw190Member
Hello!
Maybe you can help me because the team from Studiopress is not playing nice and is not helpful at all.
I'm trying to set up a CDN for my website build with Altitude Pro. The CDN is from KeyCDN.
First I thought that this will be a walk in the park - set up CNAME, make a pull zone, add it to the plugin and ready - but not with this theme. To be clear - that is ow it went with infolotnicze.pl and winterencie.info (Genesis based)
The CDN only pulls js and css files and images which are not a part of the theme background.
So I have asked the suport to fix it - obviously other themes work OK and pull everything and then serve from CDN but not Altitude Pro.
The site is:
prywatnosc.winternecie.info
Here you can see that the images are not served from CDN:
https://gtmetrix.com/reports/prywatnosc.winternecie.info/4hTRoPxRBut they are on the CDN – for example:
http://cdn.prywatnosc.winternecie.info/wp-content/uploads/2016/03/jurasica.jpgI use CDN enabler plugin and Autoptimize to serve assets from CDN and it works very vell for winternecie.info which is pure Genesis:
https://gtmetrix.com/reports/winternecie.info/FePqAGQ1 - everything served from CDN.The suport team advised me to remove all the images which was pure nonsens, re-upload them, set the theme again – this was supposed to help. I did it and wasted an hour. They even didn't read my tickests that the images are on the CDN but are not pulled from it.
Then I got a response that I should try an other theme with background images to see if they work – I did it:
Zerif Lite theme with background images:
https://gtmetrix.com/reports/test.winternecie.info/GbRpce9q – all served from CDN.The last response made me really mad – I got something about a post that I follow and a stupid copy paste from some tutorial. Rubish. I don't follow any post, topics connected with my problem so I don't know why did person wrote that to me.
And a statement that there is nothing in their themes which prevents from using a CDN.
But why don't they try to set it up with a CDN and prove me wrong? KeyCDN has 30 day free testing, use the plugins they recommend and prove me wrong if everything is so super ok with the theme.
Here is the page source of Altitude Pro:
type='text/css'>.front-page-1 { background-image: url(//prywatnosc.winternecie.info/wp-content/uploads/2016/03/jurasica.jpg); }.front-page-3 { background-image: url(//prywatnosc.winternecie.info/wp-content/uploads/2016/03/narzedzia.jpg); }.front-page-5 { background-image: url(//prywatnosc.winternecie.info/wp-content/uploads/2016/03/binoculars.jpg); }.front-page-7 { background-image: url(//prywatnosc.winternecie.info/wp-content/uploads/2016/03/public-domain-images-free-stock-photos-Brussels-gallery-Architecture-shopping.jpg); }It celarly shows that the images are not loaded from CDN.
Here is a snippet from Zerif Lite:
style type="text/css" id="custom-background-css">body.custom-background { background-image: url('http://test-3314.kxcdn.com/wp-content/themes/zerif-lite/images/bg.jpg'); background-repeat: repeat; background-position: top left; background-attachment: scroll; }</style><link rel="icon" href="http://test-3314.kxcdn.com/wp-content/uploads/2016/03/cropped-jurasica-32x32.jpg" sizes="32x32" /><link rel="icon" href="http://test-3314.kxcdn.com/wp-content/uploads/2016/03/cropped-jurasica-192x192.jpg" sizes="192x192" /><link rel="apple-touch-icon-precomposed" href="http://test-3314.kxcdn.com/wp-content/uploads/2016/03/cropped-jurasica-180x180.jpg"and there you go – served from CDN.
Any hints what to do now?
The support team is not helpful at all and is implying that it is something wrong with my setup which is nonsense. The above shows that with exactly the same plugins Zerif Lite works ok with CDN and Altutide Pro not.
March 20, 2016 at 5:44 am #181904Victor FontModeratorAltitude Pro generates the URLs for the background images at runtime in the theme's lib/output.php file. Output.php is called from front-page.php. The URLs are created using the WordPress get_stylesheet_directory_uri function that always returns the URI for the current theme/child theme. You cannot pull images from a CDN unless you modify this code. If you have a way to test if the CDN is active, you can make this conditional.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 20, 2016 at 7:15 am #181915fw190MemberHowdy!
Thanks for your response. The team from STUDIOPRESS has provided me with a code to solve this and also promissed to have a look at this issue for future releases.
Here is the code that works
2. Find the following code on line 23 of wp-content/themes/altitude-pro/lib/output.php: foreach( $opts as $opt ){ $settings[$opt]['image'] = preg_replace( '/^https?:/', '', get_option( $opt .'-altitude-image', sprintf( '%s/images/bg-%s.jpg', get_stylesheet_directory_uri(), $opt ) ) ); } And change it to look like this: foreach( $opts as $opt ){ $settings[ $opt ]['image'] = get_option( $opt . '-altitude-image', sprintf( '%s/images/bg-%s.jpg', get_stylesheet_directory_uri(), $opt ) );
-
AuthorPosts
- The topic ‘Altitude Pro not working with CDN’ is closed to new replies.