4 posts
  • 2 Years of Membership
  • Author Level 4
  • Canada
  • Collector Level 1
+2 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
  • Affiliate Level 3
  • Author Level 6
  • Collector Level 2
  • Weekly Top Seller
+7 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
  • 6 Years of Membership
  • Author Level 2
  • Affiliate Level 4
  • Beta Tester
+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().

3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 more
KrownThemes
says

nevermind..

4 posts
  • 2 Years of Membership
  • Author Level 4
  • Canada
  • Collector Level 1
+2 more
ReworkMedia
says

nevermind..

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

3072 posts
  • Affiliate Level 3
  • Author Level 6
  • Collector Level 2
  • Weekly Top Seller
+7 more
wickedpixel
says

nevermind..

Envato forums. The reply speed is everything. :)

1565 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • Featured Author
+2 more
OriginalEXE
says
3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 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

1565 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • Featured Author
+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.

3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 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