function makecss() { $makecss = file_put_contents(css_path(), "/********* Do not edit this file *********/\n/*\nMy Custom CSS - Maked by Salvatore Noschese\na.k.a. L'altroWeb - https://laltroweb.it/\n*/\n/********* Do not edit this file *********/\n\n" . mycustomcss()); return $makecss; }
function mccss_options() { ?> <div class="wrap"> <h2><?php _e('Custom CSS Panel', 'mccss'); ?> </h2> <form method="post" action="options.php"> <?php settings_fields('mccss_settings'); ?> <p><?php _e('Place your custom CSS code here:', 'mccss'); ?> <input type="submit" class="button-secondary" value="<?php _e('Save', 'mccss'); ?> " style="font-size: 20px; height: 35px; position: fixed; top: 35px; right: 15px; z-index: 5;" /></p> <textarea name="my_custom_css" id="my_custom_css" dir="ltr" style="width:100%;height:350px;"><?php echo get_option('my_custom_css'); ?> </textarea> <script language="javascript">var editor = CodeMirror.fromTextArea(document.getElementById("my_custom_css"), { lineNumbers: true });</script> <p> <input type="submit" class="button-primary" value="<?php _e('Save', 'mccss'); ?> " /> <input type="button" class="button-secondary" value="Top^" onclick="self.scrollTo(0, 0); return false;" style="float: right;" /> </p> </form> </div> <?php // Save also in *.css file! $mycustomcss = mycustomcss(); if (!empty($mycustomcss)) { makecss(); } elseif (empty($mycustomcss) && file_exists(css_path())) { unlink(css_path()); } }