0

我对 WordPress 很陌生。我已将我创建的 HTML 网站 ( www.reactmarketing.co.uk/servowatch ) 转换为 WordPress。在我的仪表板上,它说主题已安装,但没有显示任何图像并且 JavaScript 无法正常工作。

我的文件夹布局是:wp-content/themese/servowatch
servowatch 文件夹内是:

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

我的<head>里面是这样的。(从我找到的教程中复制)

<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>

在此先感谢,汤姆

4

2 回答 2

0

这是路径问题:) 从src="js/...to更改src="<?php bloginfo('template_directory'); ?>/js/...它会起作用。在 CSS 中,确保将图像指向如下:url('images/image.jpg');.

于 2012-07-04T12:22:01.980 回答
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>
于 2012-07-04T13:38:32.830 回答