I’m working on my first TF theme and am trying to make the technical improvements required to get it approved.
One of the things that I’ve been doing is including an @import after the style information and before standard formatting. E.g.:
The style.php puts in the various headers like “Content-Type: text/css” and allows me to set different skin options dynamically.
But I wondered if this is the best way of switching theme skins and whether it’s okay for themes submitted to ThemeForest?
- Forum Superstar
- Most Wanted Bounty Winner
- Sold between 250 000 and 1 000 000 dollars
- Has been a member for 6-7 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Won a Competition
- Bought between 100 and 499 items
- Exclusive Author
I’ve learned that the best thing to do in terms of security, file permissions, speed, is to write custom css directly into the header of the theme.. So if you don’t have a lot of options(just some colors and fonts), output custom css options directly into the theme header.
If you’re using a php file you might have speed/server issues(as some fellow authors experienced)..
If you’re using a css file and wanna write it with php, you’ll have 1 support ticket a day regarding the file not working(permissions problems)..
If you’re embedding small chunks of code into the header you’ll have none of this. If however you’re using custom skins, such as(dark, light) for example, and these have a lot of code lines inside them, you might be fine with making two separate stylesheets and activate one or the other..
Thank you Ruben, that’s very helpful.
Is this something that would have caused my theme to be rejected?
That’s good to know. Many thanks for your help.
You should also check out this function: wp_add_inline_style