我是网络开发的新手,并不确定如何解决此问题:
我遇到了一个网站的问题,我目前在自己的机器上运行wordpress并在header.php中添加以下行:
<link rel="stylesheet" type="text/css" href="includes/marquee.css" />
<script type="text/javascript" src="/includes/jquery-1.6.min.js"></script>
<script type="text/javascript" src="/includes/farinspace/jquery.imgpreload.min.js"></script>
<script type="text/javascript" src="/includes/marquee.js"></script>
比我创建的front-page.php文件看起来像这样:
<?php get_header(); ?>
<img class="marquee_panel_photo" src="/images/photos/london.jpg" alt="London" width="100" />
<div class="marquee_container">
<div class="marquee_photos"></div>
<div class="marquee_caption">
<div class="marquee_caption_content"></div>
</div>
<div class="marquee_nav"></div>
</div>
<div class="marquee_panels">
<!-- Panel -->
<div class="marquee_panel">
<img class="marquee_panel_photo" src="/images/photos/london.jpg" alt="London" width="100" />
<div class="marquee_panel_caption">
<img class="marquee_flag" src="/images/template/flag_england.jpg" width="20" height="13" />
<h2>London</h2>
<p>Fusce neque dolor adipiscing sed consectetuer et lacinia sit amet quam. Suspendisse wisi quam consectetuer in blandit sed suscipit eu eros.</p>
<p><a href="#">Check it out!</a></p>
</div>
</div>
我的目录结构如下: 前page.php文件 图片/照片 图片/模板 包括
当我在firefox中运行该文件时,我在菜单下面看不到任何内容。没有div或javascript正在运行。当我尝试在front-page.php中运行sample para时,它会显示出来。
任何有关调试的帮助都很棒
答案 0 :(得分:0)
我看不出解决这个问题的答案,所以发布以下代码供其他人参考解决它:
<?php
function my_scripts_method() {
// register your script location and dependencies
wp_register_script('custom_script',
get_template_directory_uri() . '/includes/jquery-1.10.2.min.js', array('jquery')
);
// enqueue the script
wp_enqueue_script('custom_script');
//add_action('wp_enqueue_scripts', 'my_scripts_method');
// register your script location and dependencies
wp_register_script('custom_script1',
get_template_directory_uri() . '/includes/farinspace/jquery.imgpreload.min.js',
array('jquery')
);
// enqueue the script
wp_enqueue_script('custom_script1');
// add_action('wp_enqueue_scripts', 'my_scripts_method');
// register your script location and dependencies
wp_register_script('custom_script2',
get_template_directory_uri() . '/includes/front-page.js',
array('jquery')
);
// enqueue the script
wp_enqueue_script('custom_script2');
if (is_page_template('our-story.php')) {
wp_register_script('custom_script3',
get_template_directory_uri() . '/includes/parallax.js',
array('jquery')
);
// enqueue the script
wp_enqueue_script('custom_script3');
}
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
?>