• Resolved Fryvisuals

    (@fryvisuals)


    I’ve been trying to remove 2 footer links with css in them. The first is a <script> tag with an id=”tmpl-tribe_customizer_css”. This is a script tag with CSS in it… WHY? I’ve searched through all the code looking for the function that generates this. I’m using the free version of the plugin for a simple event listing using the default tribes css styles.

    The second is a normal <style> tag with id=”tribe_customizer_css”

    Where is this coming from? How to dequeue?
    CSS in wordpress footer
    [https://imgur.com/a/UiqNk] screenshot of links

    • This topic was modified 7 years, 8 months ago by Fryvisuals. Reason: fixing img
    • This topic was modified 7 years, 8 months ago by Fryvisuals.
    • This topic was modified 7 years, 8 months ago by bdbrown.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Fryvisuals

    (@fryvisuals)

    Found it this morning.

    It’s located in customizer.php line 122
    add_action( 'wp_print_footer_scripts', array( $this, 'print_css_template' ), 15 );
    From Function:

    
    // If we don't have anything on the customizer don't print empty styles
    		// On Customize Page, we don't care we need this
    		if ( ! is_customize_preview() && empty( $css_template ) ) {
    			return false;
    		}
    // All sections should use this action to print their template
    		echo '<script type="text/css" id="' . esc_attr( 'tmpl-' . $this->ID . '_css' ) . '">';
    		echo $css_template;
    		echo '</script>';
    
    		// Place where the template will be rendered to
    		echo '<style type="text/css" id="' . esc_attr( $this->ID . '_css' ) . '">';
    		echo $this->parse_css_template( $css_template );
    		echo '</style>';

    I don’t get why this is on every single page… Is it poor programming or laziness? Honestly, any plugin needs to enqueue their resources ONLY WHERE NEEDED. I don’t get it.

    I’ll fix it myself.

    • This reply was modified 7 years, 8 months ago by Fryvisuals.
    Thread Starter Fryvisuals

    (@fryvisuals)

    Here’s the fix
    remove_action( 'wp_print_footer_scripts', array( Tribe__Customizer::instance(), 'print_css_template' ), 15 );

    Removing these styles while using the free plugin version with tribes default template styles does nothing to alter the display.

    Barry

    (@barryhughes-1)

    Hi @fryvisuals ??

    The first is a <script> tag with an id=”tmpl-tribe_customizer_css”. This is a script tag with CSS in it… WHY?

    That’s because it basically serves the role of a template, not unlike a <template> element but with better cross-platform results.

    Is it poor programming or laziness? Honestly, any plugin needs to enqueue their resources ONLY WHERE NEEDED.

    In general, I’d absolutely agree that resources should be included only where needed.

    I disagree that this amounts to poor programming or laziness though: we need to support many different themes and environments and this was the most pragmatic way to achieve the level of coverage and customizer-support required by our user-base.

    That doesn’t mean it’s perfect and we’ll continue to refine this: to that end, if you have specific thoughts on this, we’d welcome your feedback. Do remember though that we need to support the possible existence of calendar-related widget/shortcode output on any given page and that, as those can be generated or inserted dynamically, determining that those elements are present early enough to do things differently isn’t easy.

    Beyond that, glad to hear you hit upon a fix you are happy with — and thank you for sharing it ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove Generated Footer Scripts/Styles’ is closed to new replies.