Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1127139
    launchcatapult
    Participant

    Hey there!

    Every time I launch an X Theme site I always have issues with backgrounds not loading over HTTPS. They also never seem to work with a CDN. Now the rest of the images load over the CDN, and since the CDN is loading via SSL and https, it takes care of my insecure image issue. But for images that the CDN is NOT picking up, I get unsecured content errors ( eg. for all my backgrounds on the site ).

    Would it be possible for you to integrate something like this? This is a really low-level example for the CDN piece I implemented on my own site ( not built in X ) to solve the problem of WordPress seeming to skip over backgrounds when using a CDN. The only change would be that the constant PG_LIVE_SITE_PATH would have to be swapped for a constant that defined the URL of a site without any protocol attached to it. In the example I am using:

      /**
     *  Define site path for use in CDN String Replace Function in helpers.php
     *
     * @since 1.0
     * @author Christopher Hahn
     */
    
     if ( ! defined( 'PG_LIVE_SITE_PATH' ) ){
    	define ( 'PG_LIVE_SITE_PATH', 'theplaygroundtheatre.org' );
    }
    
    // Forces the url passed through the function
    // to use the CDN Domain defined in wp-config.
    // This is useful for setting background images with a returned URL ( from ACF for example )
    // because backgrounds do not automatically load from the CDN like normal WP images
    // @param string - $url of the image to be returned
    // @author Christopher Hahn
    // @since 1.0.0
    // ==================================================
    
    function wolf_cdn_url( $url ){
    
    	// Only if the cdn is defined
    	if( defined( 'WP_STACK_CDN_DOMAIN' ) ){
    
    		// Replace regular site domain path with CDN domain path
    		$cdn_url = str_replace( PG_LIVE_SITE_PATH , WP_STACK_CDN_DOMAIN, $url );
    
    		$url = $cdn_url;
    
    	} else{}
    
    	return $url;
    }

    Is there any chance of integrating something like this in the future, or soon, so we don’t have to go and manually modify all background images on our sites to https://. I am also trying to avoid running a search replace. Or do you guys perhaps have a background image URL filter we could make use of?

    #1127315
    Rupok
    Member

    Hi there,

    We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive.

    It usually happens when someone import demo content that might contain non-https link. For now, please download the background image and upload to your server. You can point us the demo if you can’t find the background image to download.

    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1127139 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>