I have options for the image slider in my wordpress admin panel that lets you change things such as the transition effect and speed, etc. These settings (php variables) are passed to the standard initialization script for the slider which looks like this:
<script>
jQuery(function(){
jQuery('#camera_wrap_3').camera({
height: '40%',
thumbnails: true,
time: <?php echo $pause_time; ?>,
fx: '<?php echo $transition_effect; ?>',
transPeriod: <?php echo $transition_speed; ?>,
autoAdvance: <?php echo $auto_advance; ?>,
minHeight: '50px',
mobileNavHover: false,
imagePath: '<?php echo get_template_directory_uri(); ?>/images/'
});
});
</script>
My problem is, I need to put wp_head() directly before the closing < /head> tag as that is a requirement now and when I do this there is no way to implement the above script AFTER jQuery is loaded and therefor it does not work and the slider doesn’t work either.
I’m sure there is an obvious way to do this but I can’t seem to figure it out. Can anyone give me a hand?
I can’t understand what are you trying to say BUT I can see that your script is executed after the jquery is loaded because it’s inside the jquery wrapper function . 
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
add_action('wp_head', 'slideshowSettings');
function slideshowSettings () {
$code = ........
............
echo $code;
}
PHP will always get executed before javascript. Server side versus client side.
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
And your call does not have document ready. I am not that good with jquery, but isn’t’ that needed?
duotive said
And your call does not have document ready. I am not that good with jquery, but isn’t’ that needed?
jQuery(function(){ ... cool stuff in here ... });
Can be done instead of document ready 
Hmmmmm yes it does work to use your method Duotive but the variables don’t pass. Any idea how to do that?
Check out wp_localize_script. Here’s a blog post going over adding PHP variables to your scripts.
