检查Hello Dolly plugin WordPress附带的;
// File: wp-content/plugins/hello.php
// We need some CSS to position the paragraph
function dolly_css() {
// This makes sure that the positioning is also good for right-to-left languages
$x = is_rtl() ? \'left\' : \'right\';
echo "
<style type=\'text/css\'>
#dolly {
float: $x;
padding-$x: 15px;
padding-top: 5px;
margin: 0;
font-size: 11px;
}
</style>
";
}
add_action( \'admin_head\', \'dolly_css\' );
就像@benoti提到的使用
wp_head
挂钩您不需要管理端:
add_action(\'wp_head\', \'function_callback\' );
顺便说一句,这个插件附加了样式,同样适用于脚本。