4 posts
  • United Kingdom
  • Author Level 5
  • Exclusive Author
  • 3 Years of Membership
+2 more
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

3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 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
  • United Kingdom
  • Author Level 5
  • Exclusive Author
  • 3 Years of Membership
+2 more
outerbridge
says

Thank you Ruben, that’s very helpful.

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

110 posts
  • Affiliate Level 1
  • Author Level 5
  • Beta Tester
  • Collector Level 1
+5 more
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
  • United Kingdom
  • Author Level 5
  • Exclusive Author
  • 3 Years of Membership
+2 more
outerbridge
says

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

1565 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • Featured Author
+2 more
OriginalEXE
says

You should also check out this function: wp_add_inline_style

4 posts
  • United Kingdom
  • Author Level 5
  • Exclusive Author
  • 3 Years of Membership
+2 more
outerbridge
says

Thanks – I didn’t know about that function.

by
by
by
by
by
by