但是我有相当多的 CSS 文件需要链接到主 PHP 文-6ren">
gpt4 book ai didi

php - 如何使用 WordPress 链接多个 CSS 文件

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:55:00 25 4
gpt4 key购买 nike

我知道链接你的 WordPress 主 style.css您使用的文件:

<link href="<?php bloginfo('stylesheet_url');?>"rel="stylesheet" type="text/css"/>

但是我有相当多的 CSS 文件需要链接到主 PHP 文件,例如 slider 、图片框等...

我不太确定该怎么做,因为 <?php bloginfo('stylesheet_url');?>仅适用于名为 styles.css 的样式表和我的其他样式表都有不同的名称。

有谁知道我怎样才能把它们全部涂上?

最佳答案

只需将所有样式表放在目录 wp-content\themes\twentyeleven\css 中。然后您可以通过简单地在下面添加代码来链接所有这些样式表-

<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/style1.css" />
<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/style2.css" />
<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/style3.css" />
<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/style4.css" />

享受编码。

关于php - 如何使用 WordPress 链接多个 CSS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18093124/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com