W konsoli to tak wygląda, czyli jakby to byl tekst

KOd jest zapisywany jako tekst.
Próbowałem tego na różne sposoby, ale nie wiem, dlaczego nie działa. Przesłałem zdjęcie, jak mi to wygląda. Proszę o pomoc.
<?php
/*
jQuery('select.{if.option}').on('change',function(){
if({then.val} == 'all'){
if (jQuery(this).val() == {of.value}){
jQuery({then.option}).hide(0);
} else {
jQuery({then.option}).show(0);
}
} else {
if (jQuery(this).val() == {then.value}){
var $this = jQuery({then.option} [value="{then.value}"]);
if($this.is('option')){ // if is select
$this.css();
} elseif($this.is('input')) { //if is radio
$this.parent().css();
}
} else {
var $this = jQuery({then.option} [value="{then.value}"]);
if($this.is('option')){ // if is select
$this.css();
} elseif($this.is('input')) { //if is radio
$this.parent().css();
}
}
}
});
*/
//images
function add_global_functions_images(){
return 'function add_image_prev_layer(id,imageTag){
if(id && imageTag){
jQuery(".product .woocommerce-product-gallery__image a").append(imageTag)
}
}
function remove_image_prev_layer(id){
jQuery(".product .woocommerce-product-gallery__image a .image-layer-"+id).remove(0);
} ';
}
function make_images_multiple_script($value){
ob_start();
?>
function setImage(){
jQuery('.product .woocommerce-product-gallery__image a [class^="image-layer"]').remove()
var options = jQuery('form.cart').serializeArray();
var opt ={};
jQuery.each(options,function(i,v){
opt[v.name]=v.value;
})
<?php
foreach( $value as $option ){
$image = wp_get_attachment_image( $option->then->id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), 0, array( "class" => "image-layer-".$option->then->id ));
$ifarray = array();
foreach ($option->if as $name => $value ){
$ifarray[] = 'opt["'.$name.'"] == "' . $value . '"';
}
echo 'if(' . join( " && ", $ifarray ) . '){';
echo "add_image_prev_layer('" . $option->then->id . "','" . $image . "');";
echo '}';
}
?>
}
jQuery('.woocommerce.single-product form.cart').on('change',function(){
setImage();
});
<?php
return ob_get_clean();
}
function make_images_script(){
global $post;
$script = '';
if (get_post_meta( $post->ID, 'images_field', true ) || get_post_meta( $post->ID, 'images_field', true ) != ''){
$options = json_decode(stripslashes(get_post_meta( $post->ID, 'images_field', true ) ) );
$script = add_global_functions_images();
$script .= make_images_multiple_script($options);
}
return $script;
}
//loginc
function make_logic_single_script($data){
$ifarray = array();
foreach ($data->if as $name => $value ){
if ($name != '---'){
$ifarray[] = 'opt["'.$name.'"] == "' . $value . '"';
}
}
$ret = '';
$ret .= 'if(' . join( " && ", $ifarray ) . '){';
if($data->then->hide->value == 'all'){
$ret .= "jQuery('#".$data->then->hide->key."').addClass('hide-value'); ";
} else {
$ret .= "jQuery('#".$data->then->hide->key." [value=".'"'.$data->then->hide->value.'"'."]').closest('label').addClass('hide-value'); ";
}
$ret .= "jQuery('#".$data->then->set->key." [value=".'"'.$data->then->set->value.'"'."]').prop('checked', true); ";
$ret .= '} ';
return $ret;
}
function make_logic_script(){
global $post;
$script = '';
$options = get_post_meta( $post->ID, 'logic_field', true );
if ($options){
$options = json_decode( stripslashes( $options ) );
$script .= "jQuery('.woocommerce.single-product form.cart').on('change',function(){
var options = jQuery('form.cart').serializeArray();
var opt ={};
jQuery.each(options,function(i,v){
opt[v.name]=v.value;
});
jQuery('form.cart .hide-value').removeClass('hide-value')
";
foreach ($options as $value) {
$script .= make_logic_single_script($value);
}
$script .= "});";
}
return $script;
}
function add_scripts_top_product_page(){
if(is_product()){
echo '<script id="wclg-script">
//logic
'.WCLG_ENABLE_LOGIC ? make_logic_script() : ''.'
//Images
'.WCLG_ENABLE_IMAGES ? make_images_script() : ''.'
</script>
<style>.woocommerce-product-gallery__image a {
position: relative;
display:block;
}
.woocommerce-product-gallery__image a img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
display: inherit !important;
}
.woocommerce-product-gallery__image a img.wp-post-image {
position: relative;
z-index: 0;
}</style>';
}
}
add_action( 'wp_footer', 'add_scripts_top_product_page', 50);