Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
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 '13 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? –  Maruti Mohanty Nov 16 '13 at 5:55
    
Its sorted now, thank you –  Linards Berzins Nov 18 '13 at 21:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.