wordpress - Accessing global variable in "CSS" (style.php) -


I am filing a style.php CSS so that I can use some dynamic variables in CSS in a WordPress installation:

  & lt ;? Php header ("content-type: text / css"); ? & Gt;  

and so on.

How can I enter the style.php file from a global variable or can I pass a variable?

I am trying to work inside CSS, like

  $ maincolor = $ cap-> Br_main_color;  

In addition to:

  • Ignore the caching problem This is just a personal project.
  • Passing the variable in the link of the stylesheet is very complicated for it (in my opinion).

Edit: A little more explanation: What I am doing is preparing a whole subject based on many colors and calculates the colors for the hover effect and so on. Almost 50% genres have some PHP inside them, everything works fine, if I manually style it. I paint in style, but I am trying to make it easier for less tech-savvy people and using a color picker.

To access WordPress functions, you need to include the following lines at the top of your style. Php file.

  define ('WP_USE_THEMES', false); Required ('./WP-Blog- header.php');  

The first line does not tell WordPress to run subject related processes and the second line runs the Wordpress engine. After this point you have access to WordPress functions and global variables.


Comments