Home › Forum › Customization › Different Slider for different pages with same template
Tagged: slider
This topic contains 7 replies, has 2 voices, and was last updated by StartupWP 5 years, 6 months ago.
- AuthorPosts
- September 9, 2013 at 6:29 PM #1109
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?
September 10, 2013 at 1:18 AM #1111September 10, 2013 at 7:16 AM #1113I 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.
September 10, 2013 at 7:53 AM #1115Everything looks good, just make sure that
'
and"
are straight and not curly as that will break the code.September 10, 2013 at 9:06 AM #1116the 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.September 10, 2013 at 10:39 AM #1122Okay, we’ll need to do some testing. We’ll get back to you if we’re able to pinpoint the issue. Thanks
September 11, 2013 at 11:50 PM #1125Okay, would it not be better to respond with testing results? Do you have any results and can you pinpoint the issue?
September 12, 2013 at 3:45 AM #1128Looks 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 { } ?>
- AuthorPosts
You must be logged in to reply to this topic.