I have looked all over the web for a tutorial or code on how to create a custom css textfield for a plugin. Would really appreciate if someone could help. Thanks!
ok bro lets do it
in plugin main file you must register setting for css field
Like:
register_setting('settings-group', 'css_field');
And then in your settings file where you create setting form (e.g. setting.php)
<textarea cols="50" rows="20" name="css_field" id="css_field" tabindex="1"><?php echo get_option('css_field') ?></textarea>
Then call it in your template under the get_header();
<style type="text/css">
<?php echo get_option('css_field'); ?>
</style>
or you can add in header in plugin main file Like:
function wp_css_custome(){
?>
<style type="text/css">
<?php echo get_option('css_field'); ?>
</style>
<?php
}
add_action('wp_head','wp_css_custome');
Hope this will help you :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With