


However, since most themes user a quicktaggy : getbloginfo(‘stylesheeturl’), then it must be style.css since that bloginfo-thing looks for style.css. Now you can set up variables for whatever you like: Use variablesīelow all that PHP stuff, you can just commence regular CSS writing, only you can intermix some PHP to spit out those variables. Using PHP in CSS in WordPress is no problem just like a normal file. It supports lazy loading of images with the ability to use responsive image placeholders while the images load. You can also use it to minify inline as well as external CSS or JS. php Content-typeĪt the top of your new style.php file set the Content-type back to CSS: Set up variables It can minify the CSS, JavaScript and HTML that you are using on your website. This is certainly not a new trick, but I’ve never specifically covered it so I thought I ought to. CSS minifier tool reduces file size and removes spacing, indentation, newlines. Regardless, using PHP, it is trivially easy to use variables in CSS. Online CSS minifier / compressor tool minify and compress your CSS. But thanks to this, were ready to see our minified CSS Re-run. Whether or not this is a good idea is still something I personally haven’t decided on, but I’d lean toward yes. JavaScript for PHP Geeks: Webpack for Module Loading Awesomeness Buy Access to Course. When people are asked about features they would like to CSS, “variables” always seems to come up.
