I am trying to convert my webiste to wordpress theme. I'v followed some tutorial on the web. They are good but basic.
this is how I include thejquery file:
<?php wp_enqueue_script('jquery'); ?>
in the slideShow.js the images are referenced as follows:
imagearray: [ ["/img/banner_2.jpg"], ["/img/banner_animation1.jpg"], ["/img/banner_animation2.jpg"], ["/img/banner_animation3.jpg"] ]
This is a common problem when building WP themes for the first time, because the root of the theme folder (where the CSS and WP files live) is not the same as the root of the site.
When FTPing to your site yo uprobably have a bunch of folders at the top level and one of them should be
publichtml - this folder is the root of your site so directly inside this should be your
img folder, with the banner images in it.
What may have happened is that you have put your
img folder in
www/wpcontent/themes/nameofyourtheme or some similar WP directory?
You can either move the
img folder to the correct location, or correct the links in your JS file to point to the correct location. The first slash in your path says 'start at the root of the site' so if you don't move the
img folder the ref may need to be something like:
Try making the call to the extra script with
wp_enqueue_script and make sure that wp_head is after the wp_enqueue calls to the script...
<?php wp_enqueue_script('jquery'); wp_enqueue_script( 'fadeslideshow', get_bloginfo( 'template_url' ) . '/js/fadeslideshow.js' , array( 'jquery' ) ); ?> <?php wp_head(); ?> </head>
Try adding a relative path to your images with ../:
imagearray: [ ["../img/banner_2.jpg"], ["../img/banner_animation1.jpg"], ["../img/banner_animation2.jpg"], ["../img/banner_animation3.jpg"] ]
This tells your script it needs to step up one directory and then go back down to the beginning directory.