Skip to:
Content
Pages
Categories
Search
Top
Bottom

If BP is enable conditional tag

  • @weblogian

    Participant

    It want something like this
    if bp_is_enable
    buddypress code
    else
    Wordpress code

    I think this will really help and ease theme developer

    Can this be possible?

Viewing 10 replies - 1 through 10 (of 10 total)
  • @hnla

    Participant

    I think you’ll find it does exist and is how plugins are meant to work by first checking that BP is loaded?

    It might be easier if you explained what you’re trying to achieve rather than the approach you would like to take to achieving it, then someone will be able to, possibly, provide an alternative method to achieving your requirement. It’s possibly a slightly confusing request as surely with BP not activated, no BP theme running why would any WP theme files need to be checking to see if BP is running?

    @weblogian

    Participant

    You are right, I should have explained.
    I am making theme both compatible for WP and BP by using something like this
    <?php if (get_option(‘gangmei_switch_platform’) == ‘buddypress’) { ?>
    <?php include(TEMPLATEPATH . ‘/_inc/member-search.php’); ?>
    <?php } else { include(TEMPLATEPATH . ‘/_inc/search-form.php’); } ?>

    This work 100%
    ( If buddypress is enable from theme option page, it will show the buddypress member search form
    else it will show the wordpress search form)

    But i want something like I said.

    @hnla

    Participant

    Then do either of these not serve the purpose?

    defined( ‘BP_VERSION’ )

    did_action( ‘bp_init’ )

    @weblogian

    Participant

    Thanks for the info. I have not use defined( ‘BP_VERSION’ )

    Where will be the proper place to put this code?

    @weblogian

    Participant

    Won’t it load slower if we add defined( ‘BP_VERSION’ ) did_action( ‘bp_init’ ) function

    @r-a-y

    Keymaster

    Use:

    if (defined(‘BP_VERSION’ ) { your code here;}
    else { your non-bp code here;}

    @weblogian

    Participant

    @r-a-y Thank a million for the tip. you saved my day

    @hnla

    Participant

    No problem ;)

    @weblogian

    Participant

    I think my style is better. Even if buddypress is enabled, I can still control it from the theme option page- what to display

    @hnla

    Participant

    ?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘If BP is enable conditional tag’ is closed to new replies.
Skip to toolbar