Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conditional Loading of BBPress Stylesheet


  • saracup
    Participant

    @saracup

    I have a multi-site installation of WordPress. I have created a local bbpress stylesheet in my theme that I want to load ONLY if the site administrator has activated the bbpress plugin. I am unclear on the conditional statement (e.g., “if(function_exists..”) to accomplish this as I do with other plugins that are optional. I have tried the following in my functions.php file but it throws an error. Please advise:

    <?php 
    //Load the bbpress styles if bbpress is installed //
    if (class_exists( 'bbPress' ) ) {
    ?>
    <link rel="stylesheet" id="bbpress_style" href="<?php echo get_stylesheet_directory_uri(); ?>/bbpress.css" type="text/css" media="screen" />
    <? } ?>

    Any input would be appreciated. Thank you!

Viewing 1 replies (of 1 total)
  • Hmm, first of all the bbPress stylesheet shouldn’t be loading on sites that do not have bbPress activated. If it is, then there is a problem some where, because it shouldn’t be.

    If you want to customize the bbPress CSS, you’ll want to:

    Copy:

    wp-content/plugins/bbpress/templates/default/css/bbpress.css

    to:

    wp-content/themes/[YOUR-THEME]/css/bbpress.css

    When bbPress runs, it will load your theme’s bbpress.css instead of it’s own.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar