Skip to:
Content
Pages
Categories
Search
Top
Bottom

If BP is enable conditional tag


  • Archie Webmaker
    Participant

    @weblogian

    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)

  • Hugo Ashmore
    Participant

    @hnla

    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?


    Archie Webmaker
    Participant

    @weblogian

    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.


    Hugo Ashmore
    Participant

    @hnla

    Then do either of these not serve the purpose?

    defined( ‘BP_VERSION’ )

    did_action( ‘bp_init’ )


    Archie Webmaker
    Participant

    @weblogian

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

    Where will be the proper place to put this code?


    Archie Webmaker
    Participant

    @weblogian

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


    r-a-y
    Keymaster

    @r-a-y

    Use:

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


    Archie Webmaker
    Participant

    @weblogian

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


    Hugo Ashmore
    Participant

    @hnla

    No problem ;)


    Archie Webmaker
    Participant

    @weblogian

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


    Hugo Ashmore
    Participant

    @hnla

    ?

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