New Topic

Different Slider for different pages with same template

Home › Forum › Customization › Different Slider for different pages with same template

Tagged: 

This topic contains 7 replies, has 2 voices, and was last updated by  StartupWP 3 years ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1109

    pmichaels
    Member

    The slider works with the static index page. I would like to add other static pages with the same template but have a different slider content. How can this be accomplished?

    #1111

    StartupWP
    Support

    Anything’s possible.

    See here:

    https://startupwp.com/topic/nivo-slider/#post-970

    #1113

    pmichaels
    Member

    I have been able to make a child theme work with two different sliders using the single line php code. When I try to use the php if condition code from your reference I get a blank page using this code:
    <?php
    if ( is_home() && $options[‘slider’] ) {
    echo ‘<div id=”slider”>’.do_shortcode(‘[nivoslider slug=”slider”]’).'</div>’;
    elseif ( is_page(39) ) {
    echo ‘<div id=”slider”>’.do_shortcode(‘[nivoslider slug=”slider2″]’).'</div>’;
    } else {
    }
    ?>

    I know the page id is 39 for the second page. The static index page is listed a page id 2. I can not seem to get the correct if statement to work.

    #1115

    StartupWP
    Support

    Everything looks good, just make sure that ' and " are straight and not curly as that will break the code.

    #1116

    pmichaels
    Member

    the quotation marks are straight.

    I think the IF statement is broken.
    Is this line correct: if ( is_home() && $options[‘slider’] ) ?
    The original code works fine. but for some reason the code as listed earlier results in a blank page.

    #1122

    StartupWP
    Support

    Okay, we’ll need to do some testing. We’ll get back to you if we’re able to pinpoint the issue. Thanks

    #1125

    pmichaels
    Member

    Okay, would it not be better to respond with testing results? Do you have any results and can you pinpoint the issue?

    #1128

    StartupWP
    Support

    Looks like it was just missing one bracket:

    <?php
    if ( is_home() && $options['slider'] ) {
    echo '<div id="slider">'.do_shortcode('[nivoslider slug="slider"]').'</div>';
    } elseif ( is_page(39) ) {
    echo '<div id="slider">'.do_shortcode('[nivoslider slug="slider2"]').'</div>';
    } else {
    }
    ?>
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.