I am using the supersized jquery script to use various sliding backgrounds for my wordpress page.
Now I wanted to make different slides for each site and need a php if request.
My code:
<?php if ( is_page(array('Restaurant'))) {
echo"<script type="text/javascript">
jQuery(function($) {
$.supersized({
// Functionality
slide_interval: 9000, // Length between transitions
transition: 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed: 1400, // Speed of transition
// Components
slide_links: 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
slides: [ // Slideshow Images
{
image: 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg.jpg',
title: 'Hotel-Pension-Restaurant Zur Traube in Altenahr'
}, {
image: 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg2.jpg',
title: 'Hotel-Pension-Restaurant Zur Traube in Altenahr'
}, {
image: 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg3.jpg',
title: 'Hotel-Pension-Restaurant Zur Traube in Altenahr'
},
]
});
});
</script>";}
?>
But after saving the code in my .php file the site doesn't load anymore. If I remove the php if request everything works fine again.
First I can suggest you to remove the echo of the code.
<?php if ( is_page(array('Restaurant'))) { ?>
<script type="text/javascript">
jQuery(function($){
$.supersized({
// Functionality
slide_interval : 9000, // Length between transitions
transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 1400, // Speed of transition
// Components
slide_links : 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
slides : [ // Slideshow Images
{image : 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg.jpg', title : 'Hotel-Pension-Restaurant Zur Traube in Altenahr'},
{image : 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg2.jpg', title : 'Hotel-Pension-Restaurant Zur Traube in Altenahr'},
{image : 'http://www.hotel-zur-traube.eu/wp-content/themes/hotelzurtraube/images/bg3.jpg', title : 'Hotel-Pension-Restaurant Zur Traube in Altenahr'},
]
});
});
</script>
<?php } ?>
You'll have a best visibility of the code and will not have quotes errors. Check your console with this method and tell us if you have an error