4 posts
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
  • United Kingdom
outerbridge says

Hi

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.:

@import 'includes/style.php';

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?

Many thanks

3429 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • 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
  • Referred between 500 and 999 users
+5 more
KrownThemes says

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..

4 posts
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
  • United Kingdom
outerbridge says

Thank you Ruben, that’s very helpful.

Is this something that would have caused my theme to be rejected?

108 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • United Kingdom
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Referred between 1 and 9 users
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
designedbydash says

Thank you Ruben, that’s very helpful. Is this something that would have caused my theme to be rejected?

I doubt it, however I agree with Ruben that inline CSS in the header is the way to go. It’s not as “clean” but it’s certainly more reliable.

4 posts
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
  • United Kingdom
outerbridge says

That’s good to know. Many thanks for your help.

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

You should also check out this function: wp_add_inline_style

4 posts
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
  • United Kingdom
outerbridge says

Thanks – I didn’t know about that function.

by
by
by
by
by
by