Skip to content

Instantly share code, notes, and snippets.

Shabu James SHABU89

Block or report user

Report or block SHABU89

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SHABU89
SHABU89 / functions.php
Created Oct 20, 2018
Contact Form 7 Scripts and Stylesheet files only add if shortcode present in the page else remove it.
View functions.php
function rjs_lwp_contactform_css_js() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'contact-form-7') ) {
wp_enqueue_script('contact-form-7');
wp_enqueue_style('contact-form-7');
}else{
wp_dequeue_script( 'contact-form-7' );
wp_dequeue_style( 'contact-form-7' );
}
You can’t perform that action at this time.