Php 如何在wordpress中链接外部css?
我使用的主题只支持一个主标题菜单。我正在尝试使用外部css制作另一个。如何在wordpress主题中链接外部css。您最好的选择是将文件排队到您想要的页面上 在functions.php文件中,添加以下代码Php 如何在wordpress中链接外部css?,php,css,wordpress,web,content-management-system,Php,Css,Wordpress,Web,Content Management System,我使用的主题只支持一个主标题菜单。我正在尝试使用外部css制作另一个。如何在wordpress主题中链接外部css。您最好的选择是将文件排队到您想要的页面上 在functions.php文件中,添加以下代码 // Register style sheet. add_action( 'wp_enqueue_scripts', 'register_custom_plugin_styles' ); /** * Register style sheet. */ function register_
// Register style sheet.
add_action( 'wp_enqueue_scripts', 'register_custom_plugin_styles' );
/**
* Register style sheet.
*/
function register_custom_plugin_styles() {
wp_register_style( 'my-stylesheet', 'STYLESHEETS URL' );
wp_enqueue_style( 'my-stylesheet' );
}
如果您只想在特定页面上执行此操作,那么需要将其放在If语句中,检查当前所在的页面,以了解是否要运行上述脚本
阅读有关排队脚本的更多信息:您可以使用排队,也可以转到主题的
style.css
文件,然后在其中使用@import
at规则链接
例如:
@import url("//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css");
或者,您可以编辑主题中的header.php
文件,以链接到外部样式表
例如:
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
是,或者您可以编辑主题中的
header.php
文件,以链接到外部样式表。