【问题标题】:Wordpress misses css and javascript filesWordpress 缺少 css 和 javascript 文件
【发布时间】:2014-10-22 19:19:35
【问题描述】:

所以我以前从未使用过 wordpress,我的兄弟说这要容易得多,然后只需编写脚本就可以了,所以我想我会试一试。现在我制作了一个主题并且它可以工作,但是每当我尝试使用插件时,它都没有与之关联的任何 css 或 javascript。我可能缺少一些基本的东西,但过去 6 个小时一直困扰着我。这些是我的页眉和页脚文件:

标题

<!doctype html>
<html lang="en" class="no-js">
<head>
    <title>Salon BellaVita</title>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" type="image/ico" href="favicon.ico"/>

<!-- Latest compiled and minified CSS -->
<!--    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-theme.css">-->

    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic,400,600,700,800' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />
    <link rel="stylesheet" href="http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css">

    <?PHP
    function theme_name_scripts() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri() );
    wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

    ?>
    <!-- Latest compiled and minified JavaScript -->
</head>
<body>
<!-- Header ================================================== -->
<header class="clearfix header container">
    <div class="top-line navbar navbar-fixed-top">
        <div class="container">
            <ul class="top-menu left">
                <li><a href="?page_id=24"><i class="icon ion ion-email"></i>&nbsp;Mail ons</a></li>
                <li><a href="#"><i class="icon ion ion-ios7-telephone"></i>&nbsp;Tel 0181-640588</a></li>
            </ul>
            <ul class="top-menu right">
                <li>
                    <a href="https://www.facebook.com/pages/Bella-Vita/462965717112835">
                    <i class="icon ion ion-social-facebook"></i></a>
                </li>
                <li>
                    <a href="http://www.enjoygram.com/salonbellavita">
                    <i class="icon ion ion-social-instagram-outline"></i></a>
                </li>
            </ul>
        </div>
    </div>
</header>    
<!-- End Header -->

页脚

<footer>
<div class="container">
    <div class="row">
        <div class="col-md-2 text-center">
          <p class="footercenter">
          Bella Vita
          Contact informatie: <a href="mailto:someone@example.com">
          someone@example.com</a>.
          </p>
        </div>
        <div class="col-md-8 text-center">
            <ul>
                <?php wp_list_pages( $args ); ?> 
            </ul>     
        </div>
        <div class="col-md-2 text-center">
            <p class="footercenter">
                <img src="images/logo.png" alt="Salon Bellavita" width="200" height="60" />
            </p>
        </div>
   </div>
</div>

有人知道我错过了什么吗?

【问题讨论】:

标签: javascript jquery html css wordpress


【解决方案1】:

您需要在&lt;/head&gt; 标记之前添加&lt;?php wp_head(); ?&gt;,并在&lt;/body&gt; 标记之前添加&lt;?php wp_footer(); ?&gt;。插件依赖这些标签来正确添加样式和脚本。

【讨论】:

  • 我只知道这很明显......谢谢你的回答!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-31
  • 1970-01-01
  • 2012-01-03
  • 2018-07-15
  • 1970-01-01
  • 2018-12-06
  • 2017-04-26
相关资源
最近更新 更多