Forum Replies Created

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter layza

    (@layza)

    Thanks @bcworkz, I tried what you said but it’s still not working.

    In homepage the path is <script src="https://becloudsolutions.com/wp-content/themes/thekeynote-v1-07/js/snippet.js" type="text/javascript"></script>

    While in all other pages appears to be:
    <script src="js/snippet.js" type="text/javascript"></script>

    How it can be?

    By the way, I also tried this in functions.php but it gave me the same problem. ??

    function add_chat_scripts() {
       if ( is_page ()){
        
        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' );
    

    Tnx

    • This reply was modified 8 years ago by layza.
    Thread Starter layza

    (@layza)

    Thanks for replying.

    I used the enqueu in functions, I am notte sure what you meam. But i have the sane problem. Working in homepage and not working in other pages.

    Thread Starter layza

    (@layza)

    There was an error in the path for js.
    Thank you for your help Steve, much appreciated! Have a nice day ??

    Thread Starter layza

    (@layza)

    Ok, thanks a lot. I tried but it still not working on the keynote theme, while is working ok on twentyseventeen. How it can be possible?

    Thread Starter layza

    (@layza)

    Actually, I can see website homepage, but it gives me this error on any other page:

    Fatal error: Call to undefined function wp_enque_script() in /home/content/n3pnexwpnas02_data01/42/2910242/html/wp-content/themes/thekeynote-v1-07/functions.php on line 123

    Thread Starter layza

    (@layza)

    Thanks, I tried but it doesn’t work ??

    Thread Starter layza

    (@layza)

    Hi Steve,

    thank you for your answer.

    I tried to do that, adding this in functions.php

    wp_enqueue_script( 'chat', get_theme_file_uri( '/chat/js/chat.js' ), array(), true );
    add_action( 'wp_enqueue_scripts', 'chat' );

    And this

    <script type="text/javascript" src="js/snippet.js"></script>
    In the header.php right after the <body> tag. It worked on local with twentyseventeen, but it didn’t online with the other theme. Have I done something wrong?

    Thanks

Viewing 7 replies - 16 through 22 (of 22 total)