dimanche 27 décembre 2015

Global Variables to store all CSS from Wordpress Shortcodes

I need your input and insight on using GLOBALS variable to store all CSS that is generated through Wordpress Shortcodes. I have designed Shortcode that use the following css format:

 <style>
      #divID1 .blah { /* code */}
      #divID2 .blah { /* code */}
 </style>

this works well, however while validating through http://ift.tt/1IKiNGt I keep getting errors like below:

 - Element style is missing required attribute scoped.

or sometimes..

 - Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)

Now my question is what if I keep adding that dynamic CSS code to one variable $GLOBALS['custom-css'] .= 'whatever code';

and I can print that variable within . Is this insecure ? OR the $GLOBALS doesn't work on many hosts ? Or it may effect Wordpress site, I don't want to risk and ending up it not working on many different web hosts.

Can someone please explain and/or confirm if that is a right method.

thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire