CSS should be loaded in wp_head not in wp_footer!

Home Forums Calendar Products Events Calendar PRO CSS should be loaded in wp_head not in wp_footer!

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1180857
    Greg Perham
    Participant

    Not only is it invalid HTML, but you’re breaking my ability to combine CSS for optimization.

    #1181365
    George
    Participant

    Hi Greg,

    Can you please share a link to where there is CSS from our plugins in the footer on your site?

    Thanks,
    George

    #1181876
    Greg Perham
    Participant
    #1182021
    George
    Participant

    Hi 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

    #1192480
    Support Droid
    Keymaster

    Hey 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘CSS should be loaded in wp_head not in wp_footer!’ is closed to new replies.