Home › Forum › Customization › Different Slider for different pages with same template
Tagged: slider
- This topic has 7 replies, 2 voices, and was last updated 12 years, 6 months ago by
StartupWP.
- AuthorPosts
- September 10, 2013 at 1:18 AM #1111
StartupWP
KeymasterSeptember 10, 2013 at 7:16 AM #1113pmichaels
ParticipantI 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 #1115StartupWP
KeymasterEverything 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 #1116pmichaels
Participantthe 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 #1122StartupWP
KeymasterOkay, 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 #1125pmichaels
ParticipantOkay, 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 #1128StartupWP
KeymasterLooks 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.
