[Resolved] how to force logo image to load using HTTPS with HTTP site

Home Forums Support how to force logo image to load using HTTPS with HTTP site

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #164498
    Mike A. Spell

    Hi,

    we are in preparation of moving our site from HTTP to HTTPS.
    In order to do so I am already changing a lot of content on the site, mainly the referenced images to use HTTPS instead of HTTP.
    Unfortunately I cant’t manually set the protocol to be used when defining the site logo.
    Therefore, as long as the constants WP_SITEURL and WP_HOME are still using HTTP the logo image will always be using HTTP as well.
    Can you perhaps suggest some kind of function to overrule the protocol to use fo rthe logo images as well?
    I would like to get a solution similar to what was suggested in https://wordpress.org/support/topic/responsive-images-src-url-is-https-srcset-url-is-http-no-images-loaded as a function to allow already to load the logo image of the site via HTTPS, even when the site is still offcially running via HTTP.

    Best regards

    M.

    #164556
    Tom
    Lead Developer
    Lead Developer

    Hi Mike,

    The logo uploader just using the WP Media Library which will set the protocol to whatever WP has set.

    One alternative is to use GP Hooks to show your logo instead. First you would remove it from the Customizer, and then add this into the “Before Header Content” hook:

    <div class="site-logo">
        <a href="URL TO YOUR HOMEPAGE" title="YOUR SITE TITLE" rel="home">
            <img class="header-image" src="HTTPS URL TO YOUR LOGO" alt="YOUR SITE TITLE" title="YOUR SITE TITLE" />
        </a>
    </div>  
    #164595
    Mike A. Spell

    Hi Tom,

    the proposed approach works perfectly, thanks a lot.
    I’ll just have to remember this work-around and to move back to the customizer based solution once we have moved to HTTPS completely.

    Thanks a bunch

    M.

    #164601
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.