• Hello,

    How can I add a header or footer javascript statement to Clean Yeti?
    I’m putting a sortable table on some of my pages, and I need to call a javascript to enable sorting.

    Thanks,

    Brian

Viewing 1 replies (of 1 total)
  • Theme Author Serene Themes

    (@rlafranchi)

    It’s a good idea to install a child theme if you haven’t done so already. Create a functions.php file in your child theme. The following assumes you have a script in the root of your childtheme directory named script.js:

    <?php
    // functions.php file
    
    function childtheme_add_script() {
      wp_enqueue_script('childtheme-script-js', get_stylesheet_directory_uri() . '/script.js', array(), 1.0.0, false);
    }
    add_action( 'wp_enqueue_scripts', 'childtheme_add_script' );
    ?>

    The above adds the script to the header. Change the fifth argument from false to true to add the script to the footer. If the script depends on jquery, then change the third argument from array() to array( 'jquery' )

    That should take care of it. Let me know if you have any issues.

Viewing 1 replies (of 1 total)

The topic ‘Adding javascript statement to clean yeti based’ is closed to new replies.