Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Scripts not loading in wordpress

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #46053
    matt25
    Participant

    Hi, I am trying to load some scripts in wordpress the proper way but it is not working.
    In my functions.php file I have this:

    	add_action('wp_enqueue_scripts', 'ls_scripts');
    function ls_scripts() {
    if (!is_admin()) {
    wp_enqueue_style( 'ls-css', get_template_directory_uri() . '/css/liquid-slider.css');
    wp_enqueue_script( 'jquery-easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'), '', true );
    wp_enqueue_script( 'jquery-touchSwipe', get_template_directory_uri() . '/js/jquery.touchSwipe.min.js', array('jquery-easing'), '', true );
    wp_enqueue_script( 'jquery-ls', get_template_directory_uri() . '/js/jquery.liquid-slider.min.js', array('jquery-touchSwipe'), '', true );
    }
    }

    The css file is loading fine but the javascript files aren't loading at all but I cannot work out why.
    Can anybody help?

    Thanks in advance,
    Matt

    #141345
    matt25
    Participant

    I have now made it work but only by getting rid of the reliance on jquery which obviosly isn’t ideal. Any ideas why it isn’t finding that jquery is loaded?

    This is my code for loading jquery:


    if ( !function_exists( 'core_mods' ) ) {
    function core_mods() {
    if ( !is_admin() ) {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ), false);
    wp_enqueue_script( 'jquery' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'core_mods' );
    }

    Matt

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.