I know I can use enqueue_script
and enqueue_style
to register scripts and stylesheets, however I\'m trying to print out just the link to the adminbar css:
<link rel=\'stylesheet\' id=\'admin-bar-css\' \\
href=\'http://mysite.com/wp-includes/css/admin-bar.css?ver=20111209\' type=\'text/css\' media=\'all\' />
I could just include that text on my page but I was hoping for something like
wp_print_script(\'admin-bar-css\')
Is there such a thing?
最合适的回答,由SO网友:helgatheviking 整理而成
要打印单一样式,请执行以下操作:
wp_print_styles(\'admin-bar\');
要打印单个脚本,请执行以下操作:
wp_print_scripts(\'admin-bar\');
请注意,必须首先使用wp\\u register\\u style()或wp\\u register\\u script()注册句柄。
http://codex.wordpress.org/Function_Reference/wp_register_scripthttp://codex.wordpress.org/Function_Reference/wp_register_style