Advertisement
Guest User

functions.php

a guest
May 5th, 2010
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. <?php
  2. /* Register the widget columns */
  3. //for welcome section
  4. register_sidebars( 1,
  5. array(
  6. 'name' => 'welcome-section',
  7. 'before_widget' => '<div id="%1$s" class=" box widget %2$s">',
  8. 'after_widget' => '<div class="clear"></div></div>',
  9. 'before_title' => '<h2 class="widgettitle">',
  10. 'after_title' => '</h2>'
  11. )
  12. );
  13. //for homepage first section
  14. register_sidebars( 1,
  15. array(
  16. 'name' => 'homepage-first-section',
  17. 'id' => 'homepage-first-section',
  18. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  19. 'after_widget' => '<div class="clear"></div></div></div>',
  20. 'before_title' => '<h2 class="widgettitle">',
  21. 'after_title' => '</h2><div class="widget-content">'
  22. )
  23. );
  24. register_sidebars( 1,
  25. array(
  26. 'name' => 'homepage-main-col1',
  27. 'id' => 'homepage-main-col1',
  28. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  29. 'after_widget' => '<div class="clear"></div></div></div>',
  30. 'before_title' => '<h2 class="widgettitle">',
  31. 'after_title' => '</h2><div class="widget-content">'
  32. )
  33. );
  34. register_sidebars( 1,
  35. array(
  36. 'name' => 'homepage-main-col2',
  37. 'id' => 'homepage-main-col2',
  38. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  39. 'after_widget' => '<div class="clear"></div></div></div>',
  40. 'before_title' => '<h2 class="widgettitle">',
  41. 'after_title' => '</h2><div class="widget-content">'
  42. )
  43. );
  44. //for homepage/register/activation page
  45. register_sidebars( 1,
  46. array(
  47. 'name' => 'sidebar',
  48. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  49. 'after_widget' => '<div class="clear"></div></div></div>',
  50. 'before_title' => '<h3 class="widgettitle">',
  51. 'after_title' => '</h3><div class="widget-content">'
  52. )
  53. );
  54. //for blog pages
  55. register_sidebars( 1,
  56. array(
  57. 'name' => 'blog-sidebar',
  58. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  59. 'after_widget' => '<div class="clear"></div></div></div>',
  60. 'before_title' => '<h3 class="widgettitle">',
  61. 'after_title' => '</h3><div class="widget-content">'
  62. )
  63. );
  64.  
  65. register_sidebars( 1,
  66. array(
  67. 'name' => 'profile-sidebar-top',
  68. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  69. 'after_widget' => '<div class="clear"></div></div></div>',
  70. 'before_title' => '<h3 class="widgettitle">',
  71. 'after_title' => '</h3><div class="widget-content">'
  72. )
  73. );
  74.  
  75.  
  76.  
  77. /* Load the AJAX functions for the theme */
  78. require_once( TEMPLATEPATH . '/_inc/ajax.php' );
  79.  
  80. /* Load the javascript for the theme */
  81.  
  82. wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery') );
  83.  
  84. /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */
  85. function bp_dtheme_show_home_blog() {
  86.  
  87. global $bp, $query_string, $paged;
  88. if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) {
  89. unset( $query_string );
  90.  
  91. if ( ( 'page' == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, 'paged' ) ) {
  92. $query_string .= '&paged=' . $bp->action_variables[0];
  93. $paged = $bp->action_variables[0];
  94. }
  95.  
  96. query_posts($query_string);
  97.  
  98. bp_core_load_template( 'index', true );
  99. }
  100. }
  101. add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
  102.  
  103. /*let us keep an eye on the site_url*/
  104. add_filter("site_url","my_custom_register_url",10,3);
  105. function my_custom_register_url($url, $path, $orig_scheme)
  106. { /*if the site url is used in login contentxt,let us check for the register link*/
  107. if($orig_scheme=="login")
  108. {
  109. if($path=="wp-login.php?action=register")//so it is a registration link..cool
  110. return get_option('siteurl')."/".BP_REGISTER_SLUG;//let us send it to our buddypress registration page
  111. }
  112.  
  113. return $url;
  114.  
  115. }
  116.  
  117. if(is_admin())
  118. include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'theme-admin/admin.php');
  119. //for logo, topbar logo and bottombar log
  120. $cb_logo=get_option("cb_cb_header_logo");
  121. $cb_topbar_logo=get_option("cb_cb_topbar_logo");
  122. $cb_bottombar_logo=get_option("cb_cb_bottombar_logo");
  123. if(empty($cb_logo))
  124. $cb_logo=get_stylesheet_directory_uri()."/_inc/images/logo-big.gif";
  125. if(empty($cb_topbar_logo))
  126. $cb_topbar_logo=get_stylesheet_directory_uri()."/_inc/images/topbar_logo.gif";
  127. if(empty($cb_bottombar_logo))
  128. $cb_bottombar_logo=get_stylesheet_directory_uri()."/_inc/images/bottombar_logo.gif";
  129.  
  130. /*** This was removed by Bp 1.2
  131. */
  132. function cb_get_the_body_class( $wp_classes, $custom_classes ) {
  133. global $bp;
  134.  
  135.  
  136. if ( bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page() )
  137. $bp_classes[] = 'blog-page';
  138.  
  139. if ( !bp_is_blog_page() && !bp_is_register_page() && !bp_is_activation_page() )
  140. $bp_classes[] = 'internal-page';
  141.  
  142.  
  143.  
  144.  
  145. /* Merge WP classes with BP classes */
  146. $classes = array_merge( (array) $bp_classes, (array) $wp_classes );
  147.  
  148. /* Remove any duplicates */
  149. $classes = array_unique( $classes );
  150.  
  151. return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
  152. }
  153. add_filter( 'body_class', 'cb_get_the_body_class', 11, 2 );
  154.  
  155.  
  156.  
  157. add_action("wp","add_sextra_nav");
  158.  
  159. function add_sextra_nav(){
  160. global $bp;
  161. $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';
  162.  
  163. $bp->bp_options_nav[$bp->groups->slug]["create"] = array(
  164. 'name' => "Create",
  165. 'link' => $groups_link . '/',
  166. 'slug' => $slug,
  167. 'css_id' => $item_css_id,
  168. 'position' => 100,
  169. 'user_has_access' => $user_has_access
  170. );
  171. print_r($bp->options_nav);
  172. /* Add the subnav items to the groups nav item */
  173. //bp_core_new_subnav_item( array( 'name' => __( 'My Groups', 'buddypress' ), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups' ) );
  174. //bp_core_new_subnav_item( array( 'name' => __( 'aaaaa', 'buddypress' ), 'slug' => 'aaaa', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invites', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );
  175.  
  176.  
  177. }
  178.  
  179. function sh_walled_garden()
  180. {
  181. global $bp;
  182.  
  183. if( bp_is_register_page() || bp_is_activation_page() )
  184. return;
  185.  
  186. if( ! bp_is_blog_page() && ! is_user_logged_in() )
  187. bp_core_redirect( $bp->root_domain .'/'. BP_REGISTER_SLUG );
  188. }
  189. add_action( 'get_header', 'sh_walled_garden' );
  190.  
  191. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement