0

Im trying to load the flexslider.ls file in the footer of frontpage, it just loaded Jquery only, without flexsilder.js I tried through full path

// Load the Theme JS
function theme_js() {
wp_register_script( 'flexslider', get_template_directory_uri() . '/localhost/gerboni.lv/wp-content/themes/CoatOfArms/js/flexslider.js', array('jquery'), '', true );
if ( is_front_page() ) {
wp_enqueue_script( 'flexslider' );
}
wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );

 }   
add_action( 'wp_enqueue_scripts', 'theme_js' );
add_action( 'wp_enqueue_scripts', 'theme_styles' );

after the path

// Load the Theme JS
function theme_js() {
wp_register_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), '', true );
if ( is_front_page() ) {
wp_enqueue_script( 'flexslider' );
}
wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );

}   
 add_action( 'wp_enqueue_scripts', 'theme_js' );
 add_action( 'wp_enqueue_scripts', 'theme_styles' );

did not work. And then the source is giving me completely different path to the file:

<script type='text/javascript' src='http://localhost/gerboni.lv/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>

and

<script type='text/javascript' src='http://localhost/gerboni.lv/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>

Hope its not too messy.

3
  • 1
    None of that code should load jquery-migrate and the second block of code is correct, assuming it is meant to load the script from the current theme directory. Something is mangling your file loading. It is impossible to tell what though.
    – s_ha_dum
    Nov 16, 2013 at 2:39
  • 1
    The second set of codes are right way to enqueue the scripts/styles. Can you please check the concerned file permission? Nov 16, 2013 at 5:55
  • @LinardsBerzins If it's "sorted now", then please add your solution as answer.
    – kaiser
    Oct 16, 2014 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.