Community Forums › Forums › Archived Forums › Design Tips and Tricks › Metro Pro Theme – Modify the image logo url
Tagged: background images, CDN
- This topic has 5 replies, 3 voices, and was last updated 10 years ago by
coralseait.
-
AuthorPosts
-
February 5, 2015 at 7:18 am #139794
Everlind
MemberHello,
where is possible change the url of the image of logo? Usually, I uploaded it from my domain, so "www.domain.com/", etc. Now, I am using a CDN, so I prefer that the logo is uploaded from the url "cdn.mydomain.com", etc.
I searched on style.css, functions.php, header.php, but I didn't find any voice related at logo url; where can I change it?
Thank you,
Best Regards
Web Hosting Magazine, with news, tutorial and special offers.
February 8, 2015 at 6:55 pm #140126Tom
ParticipantYou shouldn't need to do anything here. The CDN manages the content distribution and determines what and how it is served, typically with some help from plugin settings, but nothing that determines where or how a specific file is served, which they can change arbitrarily as a function of managing their service.
I'd say let the CDN do their job for a 24KB file.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]February 9, 2015 at 7:33 am #140170coralseait
MemberI *think* Everlind is asking about the logo url not automatically being replaced with the cdn version?
Everlind, on the site do all the images come from the cdn, but your logo still comes from the origin server? Are you meaning the webhosting site linked in your signature?
That site defines the logo image as
site-title a { background: url(http://www.webhostingmagazine.it/wp-content/uploads/2014/02/logo-webhostingmagazine.png) no-repeat !important; }
And I'm guessing if you don't find that in your style.css, functions.php, header.php , etc it is coming from header section of the theme customize. Dashboard --> Appearance --> Customize.
You may need to override that via functions or styles to get your url rewrite to the cdn. It looks like you're using WP Rocket for caching, you may have to clear the cache and then clear the cdn for any script changes to take effect. We've not used WP Rocket, so I'm not sure if there's a specific option or include for site header.
February 9, 2015 at 10:38 am #140200Tom
Participant@coralseait I *think* we are both correct! 🙂
Examining the page source as returned by the CDN, there are only two images served from wp-content, the rest from the CDN. The two local images are both background images, defined in the minifed CSS from the CDN. The CDN must handle background images differently as they are defined in CSS through JS and the CDN has no idea where to put them in the static HTML that it serves.
To have the CDN serve these images would require recoding to have them inline or use of a CSS preprocessor to change the URL in the stylesheet if image URLs can be obtained from CloudFlare. Found some confirmation here.
For a 384 byte page background and 28KB logo, I'm not sure it's worth the effort (but I'm going to lurk to find out).
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]February 9, 2015 at 10:59 am #140205Everlind
MemberHello coralseait,
it's correct. I am using MaxCDN but it doesn't replace e load all the images of a blog automatically, this have been the reply from official team of MaxCDN.
Some images, like banner, background and logo, should be replaced manually with the new url (cdn.mysite.it/images/a.jpg"). The problem, is that if I don't find where modify the logo URL, I can't modify it and replace the origin URL with that of my CDN.
Yes, same problem for the background, but more complicated. So, at the moment, I am trying to resolve before for the logo, than for the background.
Coralseit, I checked; I added the logo on the theme, directly from Appearence - Header, and I haven't any code in style.css, header.php o or functions.php file.
For my case, how can I override the logo via functions? So, I can use directly the logo URL of CDN.
Thank you for all at both,
Regards
Web Hosting Magazine, with news, tutorial and special offers.
February 9, 2015 at 4:48 pm #140263coralseait
MemberEverlind,
Clear the site logo out of the Customize area and add a definition to it in styles.css similar to the sinppet I quoted above, but update the background url property to reflect the cdn something like:
site-title a { background: url(http://cdn.webhostingmagazine.it/wp-content/uploads/2014/02/logo-webhostingmagazine.png) no-repeat !important; }
Note, if you get a double replacement of the url for cdn (cdn portion appears twice) then you just need the normal URL in the background property. I'm not familiar with how WP Rocket does url remapping.
That should work, but note I've not tested it. We use nginx / w3tc redirects to handle mapping to CDNs including MaxCDN and never have had to handle the logo / header manually. You'll probably have to flush WP Rocket after your header and styles.css update and probably flush MaxCDN as well.
I'm guessing there may be a way in WP Rocket to force the url remapping to occur, in most of our cases W3TC takes care of it site wide.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.