javascript - 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 -
i learning create themes wordpress , i'm trying link custom.js file via functions bit it's not working.
<?php function additional_custom_styles() { /*enqueue 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 logo replace default site name , description in 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 wordpress. .js file has scripts allow navigation change on scroll etc.
Comments
Post a Comment