Skip to content

Instantly share code, notes, and snippets.

@Chrico
Last active August 29, 2015 14:21
Show Gist options
  • Save Chrico/1f7f2d3f2be118c65999 to your computer and use it in GitHub Desktop.
Save Chrico/1f7f2d3f2be118c65999 to your computer and use it in GitHub Desktop.
ContactForm7
<?php
/**
* getting the Script and Style suffix
* Adds a conditional ".min" suffix to the file name when SCRIPT_DEBUG is NOT set to TRUE.
*
* @return String $suffix
*/
function wpcf7_get_script_suffix(){
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
}
function wpcf7_enqueue_scripts() {
$in_footer = true;
if ( 'header' === WPCF7_LOAD_JS )
$in_footer = false;
$script_suffix = wpcf7_get_script_suffix();
wp_enqueue_script(
'contact-form-7',
wpcf7_plugin_url( 'contact-form-7' . $script_suffix . '.js' ),
array('jquery', 'jquery-form'),
WPCF7_VERSION,
$in_footer
);
wpcf7_register_plugin_scripts();
}
function wpcf7_enqueue_styles() {
$script_suffix = wpcf7_get_script_suffix();
wp_enqueue_style(
'contact-form-7',
wpcf7_plugin_url( 'stylesheet' . $script_suffix . '.css' ),
array(),
WPCF7_VERSION,
'all'
);
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
wp_enqueue_style(
'contact-form-7-rtl',
wpcf7_plugin_url( 'stylesheet-rtl' . $script_suffix . '.css' ),
array(),
WPCF7_VERSION,
'all'
);
}
wpcf7_register_plugin_styles();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment