backstretch スクリプトが既に含まれている studiopress テーマを使用しています。サイトの背景画像を使用していますが、コンテンツ配信ネットワークを使用しています。
現在、画像の URL は mysite.com/media/background-image.jpg です。
こうなりたい: cdn-url.com/media/background-image.jpg
これが重要な理由は、サイトが米国中西部でホストされているにもかかわらず、英国の視聴者がいるからです。CDN は、英国ロンドンの静的コンテンツを提供します。
studiopress サポート フォーラムに投稿しましたが、まだ返信がありません。
現在の関数phpコードは次のとおりです。
//* Enqueue Backstretch script and prepare images for loading
add_action( 'wp_enqueue_scripts', 'agency_enqueue_backstretch_scripts' );
function agency_enqueue_backstretch_scripts() {
//* Load scripts only if custom background is being used
if ( ! get_background_image() )
return;
wp_enqueue_script( 'agency-pro-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'agency-pro-backstretch-set', get_bloginfo( 'stylesheet_directory' ).'/js/backstretch-set.js' , array( 'jquery', 'agency-pro-backstretch' ), '1.0.0' );
wp_localize_script( 'agency-pro-backstretch-set', 'BackStretchImg', array( 'src' => str_replace( 'http:', '', get_background_image() ) ) );
}
これを変更して、必要な結果を得ることができますか?