如何将多个 CSS 文件与 WordPress 链接

2022-01-02 00:00:00 hyperlink php wordpress css

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

I know that to link your WordPress main style.css file you use:

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

但是,我有很多 CSS 文件需要链接到主要的 PHP 文件以用于滑块、图片框等...

However I have quite a few CSS files that need to be linked to the main PHP file for things like sliders, picture boxes etc...

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

I'm not quite sure how I would do that because the <?php bloginfo('stylesheet_url');?> only works for the stylesheet that is named styles.css and my other stylesheets all have different names.

有谁知道我怎样才能把它们全部印进去?

Does anyone know how I can ink them all in?

推荐答案

只需将所有样式表放在目录 wp-content hemes wentyelevencss 中.然后您可以通过以下方式链接所有这些简单地把下面的代码-

Just put all of your stylesheets in a directory wp-content hemes wentyelevencss.Then you can link all these by simply put below code-

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

享受编码.

相关文章