I want to insert a CSS string directly from a Wordpress plugin. I donβt want to download it from an external file, and I donβt want to discuss why this is being written or something is wrong, I just want to know if this is possible.
In other words, I know I can do this:
wp_register_style('myStyleSheet', 'my-stylesheet.php'); wp_enqueue_style( 'myStyleSheet');
But I do not want to do this.
I want to do something like this (pseudo code):
$number = get_option('some_width')/2; $css = " .divbox { width: $number; } "; wp_register_style('myStyleSheet', $css); wp_enqueue_style( 'myStyleSheet');
I read wp codex for wp_register_style () and this seems impossible. Anyone have a suggestion?
ethanpil
source share