Created
September 7, 2016 08:18
-
-
Save DanielBakovic/f936567f364e0e9a75c678c3e3c6084f to your computer and use it in GitHub Desktop.
Conditional loadinf of bbPress CSS/JavaScripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function conditional_bbpress_styles_scripts() { | |
// First check that bbpress exists to prevent fatal errors | |
if ( function_exists( 'is_bbpress' ) ) { | |
//dequeue scripts and styles | |
if ( ! is_bbpress() && ! is_buddypress() ) { | |
wp_dequeue_style('bbp-default'); | |
wp_dequeue_style( 'bbp_private_replies_style'); | |
wp_dequeue_script('bbpress-editor'); | |
} | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'conditional_bbpress_styles_scripts', 99 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment