I am creating a child theme with some theme options. I want those theme options to generate a dynamic css file (style.php, not style.css). I want to generate that file whenever the theme options are updated using code that looks something like the following:
ob_start(); // Capture all output (output buffering)
require($ss_dir . '/dynamic.php'); // Generate CSS
$css = ob_get_clean( ); // Get generated CSS (output buffering) file_put_contents($ss_dir . '/mstw-tr-style.css', $css, LOCK_EX); // Save it
Of course the dynamic.php will reference the theme options, so they will have to be stored and available.
What's the right hook to use (right after the options have been stored)?
Would the WordPress theme customizer allow you to do what you need? It would certainly help with the options interface.
You must be logged in to reply to this topic.
Subscribe to get early access to new themes, discounts and brief updates about what's new with StudioPress!