This comes from the footer.php
file of a wordpress theme I would like to modify. I want one of five images to load on refresh instead of 1.jpg
every time.
<script type="text/javascript">
<?php
if((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) || ($posttype == 'post') ) {
$name = "news-and-information";
}else{
$name = $wp_query->post->post_name;
}
?>
$(document).ready(function(){
var imgPath = '/wp-content/themes/nexus/img/page-headers/<?php echo $name; ?>/1.jpg';
$('.subheader-wrapper').css('background-image', ('url("'+imgPath+'")'));
});
</script>