2012-07-04 22 views
0

我對WordPress很新。我已將我創建的HTML網站(www.reactmarketing.co.uk/servowatch)轉換爲WordPress。在我的儀表板上,它表示主題已安裝,但沒有任何圖像顯示出來,且JavaScript不起作用。WordPress - 圖片和JavaScript不工作

我的文件夾佈局是:wp-content/themese/servowatch
內servowatch文件夾是:

footer.php 
header.php 
images (dir) 
index.php 
js (dir) 
sidebar.php 
style.css 

我<頭>的內部看起來是這樣的。 (從教程中,我發現複製)

<head> 
<meta charset="<?php bloginfo('charset'); ?>" /> 
<title><?php 
    /* 
    * Print the <title> tag based on what is being viewed. 
    */ 
    global $page, $paged; 

    wp_title('|', true, 'right'); 

    // Add the blog name. 
    bloginfo('name'); 

    // Add the blog description for the home/front page. 
    $site_description = get_bloginfo('description', 'display'); 
    if ($site_description && (is_home() || is_front_page())) 
     echo " | $site_description"; 

    // Add a page number if necessary: 
    if ($paged >= 2 || $page >= 2) 
     echo ' | ' . sprintf(__('Page %s', 'twentyten'), max($paged, $page)); 

    ?></title> 
<link rel="profile" href="http://gmpg.org/xfn/11" /> 
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> 
<script type="text/javascript" src="js/jquery.main.js"></script> 
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" /> 
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 
<?php 
    /* We add some JavaScript to pages with the comment form 
    * to support sites with threaded comments (when in use). 
    */ 
    if (is_singular() && get_option('thread_comments')) 
     wp_enqueue_script('comment-reply'); 

    /* Always have wp_head() just before the closing </head> 
    * tag of your theme, or you will break many plugins, which 
    * generally use this hook to add elements to <head> such 
    * as styles, scripts, and meta tags. 
    */ 
    wp_head(); 
?> 
</head> 

在此先感謝,湯姆

回答

0

這是路徑問題:)更改從src="js/...src="<?php bloginfo('template_directory'); ?>/js/...,它會工作。在CSS中,請確保你像這樣指出你的圖像:url('images/image.jpg');

+0

感謝,生病嘗試,現在 – Tom

+0

所以我認爲JavaScript是現在的工作,謝謝。但我仍然不能顯示任何圖像。在CSS中,圖像如下所示:.logo { \t background:url('/ images/logo.png')no-repeat;}在HTML圖像中看起來像這樣:image description Tom

+0

在CSS中,不要使用'/images /',只有'images /'。在html中,前面提到'<?php bloginfo('template_directory'); ?> /圖片/ ...'。 –

0

添加模板目錄路徑您的Java腳本的src或圖片的src

<?php bloginfo('template_directory'); ?>/ 

<script type="text/javascript" src="`<?php bloginfo('template_directory'); ?>/`js/jquery-1.6.4.min.js"></script> 
<script type="text/javascript" src="`<?php bloginfo('template_directory'); ?>/`js/jquery.main.js"></script>