vendredi 27 février 2015

Wordpress Inline CSS Fomr Shortcodes to Global Variables

I am working with wordpress shortcodes. After creating a few shortcode, all my shortcodes add



<style>
// all code
</style>


and I have realised its adding a lot of extra code, since this CSS depends on the shortcode variables I have to use <style>.. what would be the best way to combine all the CSS <style></style> generated from the shortcodes used on any page and then add them to page <head> tag, instead of adding many <style> tags..


I was thinking to add $GLOBALS['custom_css'] .= 'css for each shortcode'; and then display it in header.php file..


Is this a good idea ? any insight would be highly appreciated as I want to make my code look clean and neat..


Aucun commentaire:

Enregistrer un commentaire