mardi 25 février 2020

If Else and Brackets Showing as Text in Footer

What am I missing here that results in If, Else, and brackets appearing in the footer? All the script in between run as needed but for some reason the If, Else, and the brackets show up as text. This is posted in my footer.php

    
    if(user.loggedin?) {
    <script>
      window.intercomSettings = {
        app_id: 'abc123',
        custom_launcher_selector:'#intercom',
        name: "<?=wp_get_current_user()->user_firstname?>", // Full name
        email: "<?=wp_get_current_user()->user_email?>", // Email address
        created_at: "<?=strtotime(wp_get_current_user()->created_at)?>" // Signup date as a Unix timestamp
      };
    </script>
    <script>
    // We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/u9m06p0a'
    (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/u9m06p0a';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
    </script>
} else {
    <script>
        window.intercomSettings = {
        app_id: 'abc123',
        custom_launcher_selector:'#intercom'
};
    </script>
    <script>
    // We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/u9m06p0a'
    (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/u9m06p0a';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
</script>
}

Aucun commentaire:

Enregistrer un commentaire