WordPress.org

Ready to get started?Download WordPress

Forums

js file loaded but browser says not a function (1 post)

  1. rahul14
    Member
    Posted 1 year ago #

    I passed my whole day searching for the solution.
    I have loaded waypoints jquery plugin. but browser is showing

    TypeError: jQuery(...).waypoint is not a function
    http://localhost/wordpress/wp-content/themes/mytheme/javascripts/theme.js?ver=3.5
    Line 53

    please help me. below code i am using in function to load scripts:

    function foundation_assets() {
    
    	if (!is_admin()) {
    
    		// Load JavaScripts
    		wp_enqueue_script( 'jquery');
    		wp_enqueue_script( 'waypoints', get_template_directory_uri().'/javascripts/waypoints.min.js');
    		wp_enqueue_script( 'theme', get_template_directory_uri().'/javascripts/theme.js');
    		wp_enqueue_script( 'foundation', get_template_directory_uri() . '/javascripts/foundation.min.js', array(), '1.0', true );
    		wp_enqueue_script( 'app', get_template_directory_uri().'/javascripts/app.js', array('foundation'), '1.0', true );
    
    		// Load Stylesheets
    		wp_enqueue_style( 'app', get_stylesheet_uri(), array('foundation') );
    		wp_enqueue_style( 'foundation', get_template_directory_uri().'/stylesheets/foundation.min.css' );
    		wp_enqueue_style( 'icon-fonts', get_template_directory_uri().'/fonts/style.css' );
    
    		// Load Google Fonts API
    		wp_enqueue_style( 'google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400,300' );
    
    	}
    
    }
    add_action( 'wp_enqueue_scripts', 'foundation_assets' );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags