I have developed a website that uses the "Royal Slider". The post loads custom fields from the database without a problem and loops through the images and create a lovely slideshow as can be seen at
http://www.ccmediaservices.co.uk/property/2-bedroom-apartment-to-rent/
The problem is I want to pass some custom settings to customise the slider. Normally this is achieved with this block of js at the bottom of the html just before tag. This is the settings js initialise code
<script>
jQuery(document).ready(function($) {
$('.royalSlider').royalSlider({
fullscreen: {
enabled: true,
nativeFS: true
},
controlNavigation: 'thumbnails',
autoScaleSlider: true,
autoScaleSliderWidth: 960,
autoScaleSliderHeight: 850,
loop: false,
imageScaleMode: 'fit-if-smaller',
navigateByClick: true,
numImagesToPreload:3,
arrowsNavAutoHide: true,
arrowsNavHideOnTouch: true,
keyboardNavEnabled: true,
fadeinLoadedSlide: true,
globalCaption: true,
globalCaptionInside: false,
thumbs: {
appendSpan: true,
firstMargin: true,
paddingBottom: 4
}
});
});
</script>
In wordpress this is not possible as I am well aware so I did the standard procedure of placing two action hooks in the function file. One to register the script and one to print it from the footer. This is my code
/* Royal Slider Hooks */
add_action ('init', 'register_my_royal_slider_script');
add_action ('wp-footer', 'print_my_royal_slider_script');
/* Royal Slider Functions */
function register_my_royal_slider_script() {
wp_register_script('my-script', get_template_directory_uri() . '/royalslider/custom-slider-settings.js', array('jquery'), '1.0', true);
}
function print_my_royal_slider_script() {
global $add_my_script;
if ( ! $add_my_script )
return;
wp_print_scripts('my-script');
}
Unfortunatly it is failing to have any effect. Is there something wrong with any of the above code you can see? I'm a bit confused I'm getting no errors with this
$add_my_script
coming from?