4 posts
  • Bought between 1 and 9 items
  • Canada
  • Exclusive Author
  • Has been a member for 1-2 years
  • Sold between 5 000 and 10 000 dollars
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 been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
  • Romania
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.

2441 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
  • Envato Studio (Microlancer) Beta Tester
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().

3448 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

nevermind..

4 posts
  • Bought between 1 and 9 items
  • Canada
  • Exclusive Author
  • Has been a member for 1-2 years
  • Sold between 5 000 and 10 000 dollars
ReworkMedia says

nevermind..

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

3072 posts
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
  • Romania
wickedpixel says

nevermind..

Envato forums. The reply speed is everything. :)

1466 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
3448 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

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

1466 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


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.

3448 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



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