如何链接外部css在wordpress? [英] How to link external css in wordpress?

查看:434
本文介绍了如何链接外部css在wordpress?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的主题只支持一个主标题菜单。我试图使另一个使用另一个使用外部css。如何在wordpress主题中链接外部css。

The theme i'm using supports only one primary header menu. I'm trying to make another one using another one using external css . How can i link external css in wordpress theme.

推荐答案

您最好的选择是将文件排入您想要的页面。

Your best option would be to enqueue the file onto the page you want.

在functions.php文件中添加此代码

In the functions.php file, add this code

// 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 you only want this on specific pages, then you'll need to put it round an if statement checking what page you are currently on to know if to run the above script.

有关如何排队脚本的更多信息,请访问:http://codex.wordpress.org/Function_Reference/wp_register_style

Read more about enqueuing scripts here: http://codex.wordpress.org/Function_Reference/wp_register_style

这篇关于如何链接外部css在wordpress?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆