WordPress.org

Plugin Directory

Changeset 647091


Ignore:
Timestamp:
01/02/13 17:25:23 (16 months ago)
Author:
cfinke
Message:

Contact Form: Better compatibility with the VideoPress shortcode plugin.

VideoPress's method of determining whether to print its own JS/CSS in the head causes Contact Form to prematurely print out its own CSS, preventing it from printing again. Enqueuing the Contact Form CSS where it used to print it ensures that it gets printed eventually, even if it is in the footer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/contact-form/grunion-contact-form.php

    r623875 r647091  
    618618        } 
    619619 
    620         // Output the grunion.css stylesheet if self::$style allows it 
     620        // Enqueue the grunion.css stylesheet if self::$style allows it 
    621621        if ( self::$style && ( empty( $_REQUEST['action'] ) || $_REQUEST['action'] != 'grunion_shortcode_to_json' ) ) { 
    622             ob_start(); 
    623             wp_print_styles( 'grunion.css' ); // wp_print_styles() will only ever print grunion.css once, regaurdless of how many times it is called. 
    624             $r = ob_get_clean(); 
    625         } else { 
    626             $r = ''; 
    627         } 
    628  
     622            // Enqueue the style here instead of printing it, because if some other plugin has run the_post()+rewind_posts(), 
     623            // (like VideoPress does), the style tag gets "printed" the first time and discarded, leaving the contact form unstyled. 
     624            // when WordPress does the real loop. 
     625            wp_enqueue_style( 'grunion.css' ); 
     626        } 
     627 
     628        $r = ''; 
    629629        $r .= "<div id='contact-form-$id'>\n"; 
    630630     
Note: See TracChangeset for help on using the changeset viewer.