slaFFik

BP_Component Loading

Apr 19th, 2011
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. // To create custom component I need to include this file.
  2. // I didn't find the way to avoid this.
  3. // BP_Component is not visible until I put this code
  4. if ( !class_exists( 'BP_Component' ) ){
  5.     require_once( WP_PLUGIN_DIR . '/buddypress/bp-loader.php' );
  6. }
  7. // so now BP is in the air and I can use it.
  8. class BP_SHOP_Component extends BP_Component{
  9.     function BP_SHOP_Component(){}
  10.     // other code
  11. }
  12.  
  13. $bp->shop = new BP_SHOP_Component();
  14.  
  15. // using bp_loaded doesn't help. It just doesn't work for me
  16. // Any suggestions what I'm doing wrong?
  17. // AS I understand, WP loads plugins step by step - using the order in plugins' folder. My component (/bp-shop/) is higher, than /buddypress/. So there is no BP at that loading time.
Advertisement
Add Comment
Please, Sign In to add comment