Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://codex.wordpress.org/Plugin_API/Action_Reference/customize_register
- function vfprintfCustomize($arg){
- $arg -> add_section('header_id',array(
- 'title'=>'Header Option Firoze',
- 'priority'=>120
- ));
- $arg -> add_setting('text_color_change',array(
- 'default' => '#111',
- 'transport' => 'postMessage',
- ));
- $arg -> add_control('text_color_change',array(
- 'label' => __('Color Scheme', 'themename'),
- 'section' => 'header_id',
- 'type' => 'color'
- ));
- }
- add_action('customize_register','vfprintfCustomize');
- // create style.css and generate dynamic css
- $color = get_theme_mod("text_color_change");
- $file = fopen(get_stylesheet_directory()."/dynamic.css","w");
- vfprintf(
- $file,
- "
- .site_title,.site-description,body{color:%s !important;}
- ",
- array($color)
- );
- function my_danamic_css(){
- ?>
- <?php if(file_exists(get_stylesheet_directory()."/dynamic.css")):?>
- <link rel="stylesheet" type="text/css" href="<?php echo get_theme_file_uri("dynamic.css");?>">
- <?php endif;?>
- <?php
- }
- add_action("wp_head","my_danamic_css");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement