Showing Custom Code in BSS and preview

I have a site that I have to have PHP includes to display ads. Usually, I will just add the PHP include in custom code. Unfortunately this doesn't show in the previews. So I have come up with the following solution. Hopefully, it can be of help to someone else:

The script is set to display the code on your localhost (set to 192.168 change if needed) and on bss.design

HTML: In the custom code wrap your code in a div with the class "cc"

<div class="cc"> <?php include yourfile.php?> </div>

CSS:

.cchange { background: tomato; text-align: center; border: 2px solid lime; padding: 30px;//or whatever styling you require }

.cchange:after { content: attr(data-cc);

}

JQUERY: $(".cc").each(function(){ if ( document.location.href.indexOf('bss.design') > -1 || document.location.href.indexOf('192.168') > -1) { $(this).addClass('cchange').attr('data-cc',$(this).html()); } });