Support » Plugin: WP Slick Slider » Some sliders work, some don't

  • Resolved LiMaNi

    (@limani)



    Hi there,
    I really hope you can help me.

    I’m using WP Slick Slider for al really nice header slide with text and link in my new website http://www.lebenswerk-freiburg.de/cms/.

    For every page I want to show a different slider, so I created them in the admin panel (only with the same slides for the beginnig, as I’m still constructing the site).

    In my header.php of my theme, i call them like this:

    <?php if(is_home() && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘homeslider’ ); } ?>
    <?php if(is_page(‘unser-spektrum’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘unserspektrumslider’ ); } ?>
    <?php if(is_page(‘webdesign-und-realisierung’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘webdesignslider’ ); } ?>
    <?php if(is_page(‘grafikdesign-und-werbung’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘grafikdesignslider’ ); } ?>
    <?php if(is_page(‘fotografie’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘fotografieslider’ ); } ?>
    <?php if(is_page(‘domains-und-hosting’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘domainsslider’ ); } ?>
    <?php if(is_page(‘produkte-und-shop’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘produkteslider’ ); } ?>
    <?php if(is_page(‘unternehmensbetreuung’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘unternehmensbetreuungslider’ ); } ?>
    <?php if(is_page(‘referenzen’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘referenzenslider’ ); } ?>
    <?php if(is_page(‘das-lebenswerk’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘daslebenswerkslider’ ); } ?>
    <?php if(is_page(‘unternehmen’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘unternehmenslider’ ); } ?>
    <?php if(is_page(‘team’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘teamslider’ ); } ?>
    <?php if(is_page(‘lebensnetzwerk’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘lebensnetzwerkslider’ ); } ?>
    <?php if(is_page(‘non-profit’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘nonprofitslider’ ); } ?>
    <?php if(is_page(‘kontakt’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘kontaktslider’ ); } ?>
    <?php if(is_page(‘impressum’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘impressumslider’ ); } ?>
    <?php if(is_page(‘links’) && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘linksslider’ ); } ?>
    <?php if(is_single() && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘homeslider’ ); } ?>
    <?php if(is_archive() && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘homeslider’ ); } ?>
    <?php if(is_search() && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘homeslider’ ); } ?>
    <?php if(is_404() && function_exists( ‘wp_slick_slider’ ) ){ wp_slick_slider( ‘homeslider’ ); } ?>

    This works perfectly for the home slider and the one for “unser spektrum”, which were the first two sliders I created.
    But for all the others, somthing seems wrong and I just can’t find what I did wrong, thy just don’t show. Configuration is just the same, slugs match,…

    can you help me?

    Thanks a lot,

    Lisa

    http://wordpress.org/extend/plugins/wp-slick-slider/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ben Casey

    (@casben79)

    Hi LiMaNi,

    Sorry about the late reply, did you ever get this sorted out?

    I would suggest cleaning up the code a bit. Something like this:

    if( function_exists( 'wp_slick_slider' ) ):
    
    	if( is_home() ) {
    		wp_slick_slider( 'homeslider' );
    	} elseif( is_page( 'unser-spektrum' ) ){
    		wp_slick_slider( 'unserspektrumslider' );
    	} elseif( '' ) { //Edit this and add more elseif lines as required.
    		wp_slick_slider( '..' );
    	} 
    
    endif;

    Alternatively, You could add some post meta to the pages, and use something like this:

    if( function_exists( 'wp_slick_slider' ) ):
    
    	//Use Post meta on single pages / posts, otherwise default to 'homeslider'
    	if( is_singular() ){
    		$slider = get_post_meta( get_the_ID(), 'page_slider' , true );
    	} else {
    		$slider = 'homeslider';
    	}
    
    	if( $slider && ! empty( $slider ) ){
    		wp_slick_slider( $slider );
    	}
    
    endif;

    Hi Ben,

    I finally got it working: Your suggestion helped to add the following to style.css:

    .wpss_slide{ width:1000px; }

    Now it works 🙂

    Thanks for your help!

    Lisa

    Plugin Author Ben Casey

    (@casben79)

    No Problem, Im marking this as resolved, if you have any more issues, please let me know.

    Cheers
    Ben

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Some sliders work, some don't’ is closed to new replies.