4 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Located in Canada
  • Has collected 1+ items on Envato Market
+1 more
ReworkMedia
says

Hi Guys,

We came across very interesting issue of rejection of our Wordpress theme – it is inline css in the header.

First of all, I have read all similar topics, and I also agree that there should be no inline css in the theme.

But in our case, there are such functionality that I doubt can be made without using inline css. Imagine, I need to set a page background color (or page background image) that user selects in the theme options (custom page in Wordpress). How this can be done? The easiest and the most right way, I think, is the inline css in header.php, like that:

<style type="text/css"> html { background-color: <?php echo $f->settings->bgcolor; ?>; } </style>

But reviewer have rejected theme due to this code. I wonder, how this can be done without using inline css, and should we reply to reviewer that it is normal and good practice to use inline for such cases? Note, there is no more css inline in the code.

Please reply your thoughts.

3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+6 more
wickedpixel
says

I don’t think inline css means that. Inline css is when the css is placed in the style attribute inside a tag.
The dynamic style area in the HTML header is something that even the default wordpress themes do.

2468 posts
  • Has been part of the Envato Community for over 6 years
  • Has sold $100+ on Envato Market
  • Has referred 100+ members
  • Has been a beta tester for an Envato feature
+3 more
digitalimpact
says

Hi,

First, that’s called “embeded”, not inline. Inline is <html style="...">

For adding CSS in the head element of WordPress themes, use a function that hooks to wp_head().

3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says

nevermind..

4 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Located in Canada
  • Has collected 1+ items on Envato Market
+1 more
ReworkMedia
says

nevermind..

Yeap.. your initial comment was the right one that I’m feeling and thinking too…

3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+6 more
wickedpixel
says

nevermind..

Envato forums. The reply speed is everything. :)

1554 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+2 more
OriginalEXE
says
3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says

Check out this function: http://codex.wordpress.org/Function_Reference/wp_add_inline_style

This function is nothing without an enqueue of a custom style or script .. :|

So it’s useless for me.. But i’m not the author of the thread :D

1554 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+2 more
OriginalEXE
says


Check out this function: http://codex.wordpress.org/Function_Reference/wp_add_inline_style

This function is nothing without an enqueue of a custom style or script .. :|

So it’s useless for me.. But i’m not the author of the thread :D
I did not know that there exists a WP theme that does not enqueue a custom style :)

I believe this function to be a much cleaner way to implement custom style than what author is doing, that’s why I posted it. Cluttering header.php that users often modify is not the best idea.

3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says



Check out this function: http://codex.wordpress.org/Function_Reference/wp_add_inline_style

This function is nothing without an enqueue of a custom style or script .. :|

So it’s useless for me.. But i’m not the author of the thread :D
I did not know that there exists a WP theme that does not enqueue a custom style :)

I’m stupid. I work on a theme with no custom styles, but of course i have custom scripts :D

by
by
by
by
by
by