FacetWP – CDN urls with CSS-based templates

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_filter( ‘facetwp_ajax_response’, function( $output ) {
$siteurl1 = ‘https://100audio.com/wp-content’;
$siteurl2 = ‘http://100audio.com/wp-content’;
$cdn_url = ‘https://7.100audio.com/wp-content’;

$output = json_decode( $output, true ); // decode
$output[‘template’] = str_replace( $siteurl1, $cdn_url, $output[‘template’] );
$output[‘template’] = str_replace( $siteurl2, $cdn_url, $output[‘template’] );
return json_encode( $output ); // encode
}, 8 );

{{/gist}}