I’ve been doing some research for a while now and I haven’t come up with a straightforward solution.
While working off of a WordPress theme, I would like to implement a variable into my CSS document.
I understand this can be done through PHP and CSS Preprocessors.
However, I would like to take a CSV or XLS file, upload it to my server, and then have the CSS document recognize a cell or value within that file.
So ultimately, I’m looking to do the following:
a{
font-size: @fontsize;
}
Where @fontsize in the CSV or XLS document is noted as:
20px;
I know WordPress also offers plugins to import CSV files, but from what it seems, it does not link them directly to the CSS documents.
There’s no built-in way, but it’s easy to add in an internal style sheet. Write a function in functions.php to read the CSV file and extract the value. Then use the wp_head action hook: