Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_print_head_scripts() {
- if ( ! is_admin() ) : ?>
- <!-- Chatra {literal} -->
- <script>
- <?php if ( is_user_logged_in() ) : ?>
- <?php $current_user = wp_get_current_user(); ?>
- window.ChatraSetup = {
- clientId: <?php echo $current_user->ID; ?>
- };
- window.ChatraIntegration = {
- // main fields
- name: '<?php echo htmlspecialchars( $current_user->user_firstname . ' ' . $current_user->user_lastname, ENT_QUOTES ); ?>',
- email: '<?php echo $current_user->user_email; ?>',
- };
- <?php endif; ?>
- ChatraID = 'eJ4iwDrjhx7LacbTE';
- (function(d, w, c) {
- var n = d.getElementsByTagName('script')[0],
- s = d.createElement('script');
- w[c] = w[c] || function() {
- (w[c].q = w[c].q || []).push(arguments);
- };
- s.async = true;
- s.src = (d.location.protocol === 'https:' ? 'https:': 'http:')
- + '//call.chatra.io/chatra.js';
- n.parentNode.insertBefore(s, n);
- })(document, window, 'Chatra');
- </script>
- <!-- /Chatra {/literal} -->
- <?php
- }
- add_action( 'wp_print_scripts', 'wpf_print_head_scripts' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement