Okay
  Public Ticket #179477
Woo Commerce And Nectar Slider
Closed

Comments

  • Tom started the conversation

    Hi,

    I have been trying to add a necter slider to the main shop page, I know I could use short codes but I cannot find one to show the sort and other options. So I went the route of editing the woocommerce.pgp file within the salient directory. I have added this code to the page (within Php tags):

    <code>echo do_shortcode('[nectar_slider location="Home" full_width="true" arrow_navigation="true" bullet_navigation="true" parallax="true" loop="true" slider_height="550" desktop_swipe="true" autorotate="5000"]');</code>

    Which works to the extent that the html is added to the page for the slider however remaiins hidden as has attribute display:none; I assumed that it was due to the lack of the required javascript and comparing the head section of the shop and another page with the slide showed that I was correct the nectar-slider.js file isn't present.Any idea how I can get this to work ?

    Thanks for your time, Tom 

  •  8,940
    Tahir replied

    Hey Tom!

    Why don't you use the Revolution Slider on there ?. You wont have the js missing issue with it. 

    Cheers


    ThemeNectar Support Team 

  • Tom replied

    Hi Tahir,

    I guess I could but then I am loading yet another load of JavaScript where as by just reusing the Nectar Slider the javascript will be cached on the visitors browser ! Just seems like a tidier solution, I just can't see anywhere where the Nectar slider is wp_dequeue_script, or similar on a woo commerce page.

    Thanks for the suggestion,

    Tom

  •  1,086
    ThemeNectar replied

    Hey Tom!

    If you need to enqueue the Nectar Slider on pages where it wouldn't normally open up the functions.php file and remove the wrapping conditional from this:

     
    //nectarSlider mediaElement 
    $portfolio_extra_content = get_post_meta($post->ID, '_nectar_portfolio_extra_content', true);
    if(stripos( $post->post_content, '[nectar_slider') !== FALSE || stripos( $portfolio_extra_content, '[nectar_slider') !== FALSE || stripos($post->post_content, '[vc_gallery type="nectarslider_style"') !== FALSE || stripos( $portfolio_extra_content, '[vc_gallery type="nectarslider_style"') !== FALSE) {
    		
    	if ( floatval(get_bloginfo('version')) >= "3.6" ) {
    		wp_enqueue_script('wp-mediaelement');
    		wp_enqueue_style('wp-mediaelement');
    	} else {
    			
    		//register media element for WordPress 3.5
    		wp_register_script('wp-mediaelement', get_template_directory_uri() . '/js/mediaelement-and-player.min.js', array('jquery'), '1.0', TRUE);
    		wp_register_style('wp-mediaelement', get_template_directory_uri() . '/css/mediaelementplayer.min.css');
    			
    		wp_enqueue_script('wp-mediaelement');
    		wp_enqueue_style('wp-mediaelement');
    	}
    		
    	wp_enqueue_script('nectarSlider');
    }
    
    so that it becomes:
     
    //nectarSlider mediaElement 	
    if ( floatval(get_bloginfo('version')) >= "3.6" ) {
    	wp_enqueue_script('wp-mediaelement');
    	wp_enqueue_style('wp-mediaelement');
    } else {
    			
    	//register media element for WordPress 3.5
    	wp_register_script('wp-mediaelement', get_template_directory_uri() . '/js/mediaelement-and-player.min.js', array('jquery'), '1.0', TRUE);
    	wp_register_style('wp-mediaelement', get_template_directory_uri() . '/css/mediaelementplayer.min.css');
    			
    	wp_enqueue_script('wp-mediaelement');
    	wp_enqueue_style('wp-mediaelement');
    }
    		
    wp_enqueue_script('nectarSlider');
    
    
    Cheers :)