Wordpress Adding Inline Styles


#1

Hello.
I have a small question about registering Customizer API / Redux styles.
What is the right method of adding style file to head ?
For example I have test.php file that consist of codes like:

  <?php global $redux_theme_option; ?>
     <style type = 'text/css'>
    h1{color:<?php echo $redux_theme_option["h1_color"];?>
    </style>

How can i add this file to head with right method?
Thanks!


#2

you can refer here https://codex.wordpress.org/Function_Reference/wp_add_inline_style


#3

As @nicethemez said, wp_add_inline_style() is the solution.

Good Luck!


#4

Thanks :slight_smile: