Home › Forums › Calendar Products › Events Calendar PRO › CSS should be loaded in wp_head not in wp_footer!
- This topic has 5 replies, 4 voices, and was last updated 7 years, 5 months ago by Greg Perham.
-
AuthorPosts
-
October 21, 2016 at 12:14 pm #1180857Greg PerhamParticipant
Not only is it invalid HTML, but you’re breaking my ability to combine CSS for optimization.
October 22, 2016 at 12:23 pm #1181365GeorgeParticipantHi Greg,
Can you please share a link to where there is CSS from our plugins in the footer on your site?
Thanks,
GeorgeOctober 24, 2016 at 7:36 am #1181876Greg PerhamParticipantview-source:http://dev.bplusf.com/jcoh/calendar/
October 24, 2016 at 11:23 am #1182021GeorgeParticipantHi Greg,
Can you please confirm if this is the main calendar page that gets generated automatically?
Or is this page one whose calendar instance is generated by the [tribe_events] shortcode?
If it’s the latter, then the CSS is there by design. The [tribe_events] shortcode loads a number of scripts and stylesheets; for the sake of performance, we designed things so that all those resources would not load on every single page on the front-end of your site, but instead only on pages where an instance of the [tribe_events] shortcode exists.
Shortcodes are passed in the WordPress hook the_content(). This runs later than wp_head(), so if there is a shortcode instance on the page it is not detected until after the head of the document’s already generated. So the required scripts and styles get loaded into the site footer.
I hope this explanation sheds light on the decision; it’s a Catch-22, because if you want the stylesheets to not be in the footer, then they’d have to be loaded into the wp_head generally and thus would be loading on many many pages where they’re not needed.
— George
November 15, 2016 at 8:35 am #1192480Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘CSS should be loaded in wp_head not in wp_footer!’ is closed to new replies.