简体   繁体   English

具有自己主题的文件的路径[Wordpress]

[英]Paths of files in own theme [Wordpress]

I designed a website for a client, out of WordPress. 我用WordPress为客户设计了一个网站。 But I want the design to work with WordPress because on the website they should be able to publish news. 但是我希望该设计能够与WordPress一起使用,因为它们应该可以在网站上发布新闻。 I will get the news with the functions of WordPress. 我将获得有关WordPress功能的新闻。 I have the theme running, but I have a problem with the links of the menus, css, js, etc. I want to know where to configure so that the routes are correct. 我正在运行主题,但是菜单,css,js等的链接存在问题。我想知道在哪里进行配置,以便路由正确。

The web structure contains the css, img, js, template, index.php, style.php folders. 网络结构包含css,img,js,模板,index.php,style.php文件夹。

I have a default-head.php file and scripts.php in the template folder that contains this. 我在包含此文件的模板文件夹中有一个default-head.php文件和scripts.php。

default-head.php 默认head.php

    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="css/sidr.light.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/bootstrap-overwrite.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="shortcut icon" type="image/png" href="img/favicon.png"/>

scripts.php scripts.php

<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/functions.js"></script>
<script src="js/sidr.min.js"></script>
<script src="js/bootbox.min.js"></script>

These files are included in the index. 这些文件包含在索引中。 The code of my menu is. 我菜单的代码是。

<div class="container-fluid">
        <div class="row">
            <div id="header" class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="navbar navbar-inverse navbar-static-top" role="navigation">
                    <div class="container-fluid">
                        <div class="navbar-header">
                          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                          </button>
                          <a id="logo" href="/"></a>
                        </div>

                        <div class="navbar-collapse collapse">
                          <ul class="nav navbar-nav">
                            <li><a href="/" class="first"><span class="fa fa-home"></span>Inicio</a></li>
                            <li><a href="noticias.php"><span class="fa fa-newspaper-o"></span>Noticias</a></li>
                            <li><a href="eventos.php"><span class="fa fa-calendar"></span>Eventos</a></li>
                            <li><a href="acerca.php"><span class="fa fa-info"></span>Acerca</a></li>
                            <li><a href="contacto.php"><span class="fa fa-phone"></span>Contacto</a></li>
                          </ul>

                          <!-- <ul class="nav navbar-nav navbar-right">
                             <li class="dropdown">
                                <li><a href="#"><span class=""></span>Asociarme</a></li>
                            </li>
                          </ul> -->

                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

Thanks in advance. 提前致谢。

I will be careful. 我会小心的。

Regards 问候

Have a look at https://developer.wordpress.org/reference/functions/wp_enqueue_style/ 看看https://developer.wordpress.org/reference/functions/wp_enqueue_style/

Example

wp_enqueue_script('oxfam_js_cookie', 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.0/js.cookie.min.js', array(), null, true);

will add 将添加

<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.0/js.cookie.min.js'></script>

Or a Basic Method 或基本方法

You can just use this in your PHP files for basic linking 您可以在PHP文件中使用此链接进行基本链接

<img src="<?php echo get_template_directory_uri(); ?>/images/image.jpg"/>

Additional answer 附加答案

Custom Modifications 自定义修改

<!-- CSS
    ========== 
<link href="<?php //bloginfo('template_directory'); ?>/dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="<?php //bloginfo('template_directory'); ?>/fonts/fontstyles.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="<?php //bloginfo( 'stylesheet_url' ); ?>" media="all">-->
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!-- Favicons
    ========== -->
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
<link rel="apple-touch-icon" href="<?php bloginfo('template_directory'); ?>/media/images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="<?php bloginfo('template_directory'); ?>/media/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php bloginfo('template_directory'); ?>/media/images/apple-touch-icon-114x114.png">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM