Support » Plugins » Image Slider on WP E-commerce, troubleshoot enqueue script

  • Hello everyone,

    I have recently been working with WordPress and the WP E-commerce plug-in. As part of my products page I have been attempting to add the following jquery slider for product details:

    Link to Slider

    I understand that I must enqueue the javascript and have gone through several step-by-step guides and I still seem to be doing something wrong. I am running on mamp localhost, which I figured might be a potential problem?

    The div and html content show up, but the images won’t load. I got the slider to work on my frontpage (where all javascript seems to work), but then it of course does not work on the other pages, specifically my product details page.

    If anyone can push my in the right direction or offer help on how to properly enqueue the javascript, it would be GREATLY appreciated. Below is the enqueue code I have tried. Thanks in advance for looking.

    In the functions.php I put:

    function load_my_scripts() {
    	wp_enqueue_script('load', get_template_directory_uri() . 'scripts/productload.js', array('jquery'), '1.0', false);
    	wp_enqueue_script('slides', get_templae_directory_uri() . 'scripts/slides.min.jquery.js', array('jquery'), '1.0', false);
    } // End load_my_scripts()

    In the header above the <?php wp_head(); ?> I placed:

    add_action('wp_print_scripts', 'load_my_scripts', 1);

    During a different attempt, I created the following function through a different step-by-step guide but I kept getting syntax errors in the functions.php:

    if (function_exists('load_my_scripts')) {
    function load_my_scripts() {
    	if (!is_admin()) {
    	wp_deregister_script( 'jquery' );
    	wp_register_script('jquery', '');
    	wp_register_script('slides', bloginfo('template_url').'/scripts/slides.min.jquery.js');
    	wp_register_script('load', bloginfo('template_url').'/scripts/productload.js');
    add_action('init', 'load_my_scripts');

    *Note: the productload.js is a .js file I created to place the following code:

    				preload: true,
    				preloadImage: 'wp-content/themes/samplin/images/img/loading.gif',
    				effect: 'slide, fade',
    				crossfade: true,
    				slideSpeed: 350,
    				fadeSpeed: 500,
    				generateNextPrev: true,
    				generatePagination: false

    Thanks again, looking forward to a response.

  • The topic ‘Image Slider on WP E-commerce, troubleshoot enqueue script’ is closed to new replies.