I am currently learning to create themes for WordPress and I’m trying to link my custom.js file via the functions bit but it’s just not working.


function additional_custom_styles() {

    /*Enqueue The Styles*/
    wp_enqueue_style( 'themename', get_template_directory_uri() . '/css/main.css' );
    wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css' );
    wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array( 'jquery' ), '3.3.6', true );


add_action("wp_enqueue_scripts", "launch_scripts");
    function launch_scripts() {
        $internal_path = get_template_directory_uri() . '/js/';
        wp_enqueue_script('main-script', $internal_path . 'custom.js', array(''));

add_action( 'wp_enqueue_scripts', 'additional_custom_styles' );

function mytheme_customize_register( $wp_customize ) {
    $wp_customize->add_section( 'themeslug_logo_section' , array(
        'title'         => __( 'Logo', 'themeslug' ),
        'priority'      => 30,
        'description'   => 'Upload a logo to replace the default site name and description in the header',
    $wp_customize->add_setting( 'themeslug_logo' );
    $wp_customize->add_control( new WP_Customize_Image_Control(
        $wp_customize, 'themeslug_logo', array(
            'label'     => __( 'Logo', 'themeslug' ),
            'section'   => 'themeslug_logo_section',
            'settings'  => 'themeslug_logo',
add_action( 'customize_register', 'mytheme_customize_register' );


http://wordpress.taylorgathercole.co.uk – link to the WordPress. The .js file has scripts to allow the navigation to change on scroll etc.

Read more here: My custom.js isn’t working when converting a website over to WordPress. I am using the correct way, by linking in the functions.php


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: