这来自footer.php
我想修改wordpress主题的文件。我希望在刷新时加载五个图像中的一个,而不是1.jpg
每一次。
<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>