Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Update css dynamically
- <?php
- /** Write to options.css file **/
- function css_generator(){
- ob_start();
- require_once( 'file.php' );
- file_put_contents( "options.css",ob_get_clean());
- }
- css_generator();
- // Object Oriented Method
- /* class dyNamic_css{
- public function css_generator(){
- ob_start();
- require_once( 'file.php' );
- file_put_contents( 'options.css',ob_get_clean());
- }
- }
- $output = new dyNamic_css;
- $output -> css_generator();
- */
- /*
- $ss_dir = get_stylesheet_directory(); // Shorten code, save 1 call
- ob_start(); // Capture all output (output buffering)
- require($ss_dir . '/library/css/dynamic.css.php'); // Generate CSS
- $css = ob_get_clean(); // Get generated CSS (output buffering)
- file_put_contents($ss_dir . '/library/css/static.css', $css, LOCK_EX); // Save it
- */
- ?>
- // usages in wordpress (use in framework or cmb2)
- function my_style_css(){
- ob_start();
- require_once( get_stylesheet_directory().'/css/filestyle.php' );
- file_put_contents( get_stylesheet_directory()."/css/options.css",ob_get_clean());
- }
- my_style_css();
- // OR use without any function method
- ob_start();
- require_once( get_stylesheet_directory().'/css/filestyle.php' );
- file_put_contents( get_stylesheet_directory()."/css/options.css",ob_get_clean());
- // Note:if break any file or any part of template then call always this code at the beneath of all codes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement