【问题标题】:How to Link Responsive.css with a custom wordpress page如何将 Responsive.css 与自定义 wordpress 页面链接
【发布时间】:2016-11-12 15:30:24
【问题描述】:

您好,我是 wordpress 新手。我创建了一个 wordpress 主题(用于网站开发),现在只有 Index 、 header 、 footer 文件和 style.css 我想将 Responsive.css 与 index.php 页面链接,该页面存储在“/css/responsive.css "

我知道我们可以通过 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url') ?>" type="text/css"> 链接 style.css

但我很困惑如何将响应式 css 与页面链接。请帮帮我。

【问题讨论】:

    标签: wordpress responsive-design wordpress-theming


    【解决方案1】:

    在您的主题的functions.php 文件中,您需要添加以下内容:

    function so_38294160_enqueue_style() {
        wp_enqueue_style( 'responsive', get_stylesheet_directory_uri() . '/css/responsive.css' ); 
    }
    add_action( 'wp_enqueue_scripts', 'so_38294160_enqueue_style' );
    

    请查看wp_enqueue_scripts()

    请记住,您的主题中需要wp_head()wp_footer()。阅读 Codex 中的theme development

    【讨论】:

      猜你喜欢
      • 2016-11-11
      • 2021-02-22
      • 2012-05-18
      • 2017-07-29
      • 2018-01-08
      • 1970-01-01
      • 2020-06-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多