Snippet in all pages
-
Hi there,
I have a chat installed on a website (here) – not working on chrome and firefox. It supposed to be visible on every page, but it shows up only in home.
This is how I added the script in theme’s functions:
function add_chat ( ) { ?> <script type="text/javascript"> SERVICE_PATTERN_CHAT_CONFIG = { appId: ### clientId: ### apiUrl: ### tenantUrl: ### width: 300, chatPath: '' }; </script> <script type="text/javascript" src="/js/snippet.js"></script> <?php } add_action ('wp_footer', 'add_chat' );
I also tried the wp_enqueue down there, but I had no luck.
function add_chat_scripts() {
`wp_register_script( ‘chat’, get_stylesheet_directory_uri() . ‘/js/chat.js’ , array(), true );
wp_register_script( ‘chat-snippet’, get_stylesheet_directory_uri() . ‘/js/snippet.js’, array(‘chat’) );
wp_enqueue_script (‘chat’);
wp_enqueue_script(‘chat-snippet’);
}
add_action( ‘wp_enqueue_scripts’, ‘add_chat_scripts’ );`
`Any help?
Thank you
- The topic ‘Snippet in all pages’ is closed to new replies.