I want to register a new css document that I'm storing inside a PHP file (so that I can create variable css rules). I tried doing this:
function tps_admin_scripts() {
$plugin_url = plugin_dir_url( __FILE__ );
wp_register_script('admin-variable-style', $plugin_url.'css/style-variable.php');
wp_enqueue_script('admin-variable-style');
}
add_action('admin_enqueue_scripts', 'tps_admin_scripts');
And I've also tried wp_enqueue_style with no luck.
Additionally, I tried
require_once (plugin_dir_path(__FILE__).'css/style-variable.php');
But that simply rendered the raw style/html onto the page.
Inside the .php file, I have something like this:
<?php header("Content-type: text/css"); ?>
<?php
//Calendar Color Pickers
$tpsSettings = get_option( 'tps_rental_settings' );
?>
.colorAvailable {
background-color: <?php echo $tpsSettings['tps_calendar_color_available']; ?>
}
Is this possible to do with WP? If not, any other solutions to including a php file to run as an additional css file?