Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Register the widget columns */
- //for welcome section
- register_sidebars( 1,
- array(
- 'name' => 'welcome-section',
- 'before_widget' => '<div id="%1$s" class=" box widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div>',
- 'before_title' => '<h2 class="widgettitle">',
- 'after_title' => '</h2>'
- )
- );
- //for homepage first section
- register_sidebars( 1,
- array(
- 'name' => 'homepage-first-section',
- 'id' => 'homepage-first-section',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h2 class="widgettitle">',
- 'after_title' => '</h2><div class="widget-content">'
- )
- );
- register_sidebars( 1,
- array(
- 'name' => 'homepage-main-col1',
- 'id' => 'homepage-main-col1',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h2 class="widgettitle">',
- 'after_title' => '</h2><div class="widget-content">'
- )
- );
- register_sidebars( 1,
- array(
- 'name' => 'homepage-main-col2',
- 'id' => 'homepage-main-col2',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h2 class="widgettitle">',
- 'after_title' => '</h2><div class="widget-content">'
- )
- );
- //for homepage/register/activation page
- register_sidebars( 1,
- array(
- 'name' => 'sidebar',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h3 class="widgettitle">',
- 'after_title' => '</h3><div class="widget-content">'
- )
- );
- //for blog pages
- register_sidebars( 1,
- array(
- 'name' => 'blog-sidebar',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h3 class="widgettitle">',
- 'after_title' => '</h3><div class="widget-content">'
- )
- );
- register_sidebars( 1,
- array(
- 'name' => 'profile-sidebar-top',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '<div class="clear"></div></div></div>',
- 'before_title' => '<h3 class="widgettitle">',
- 'after_title' => '</h3><div class="widget-content">'
- )
- );
- /* Load the AJAX functions for the theme */
- require_once( TEMPLATEPATH . '/_inc/ajax.php' );
- /* Load the javascript for the theme */
- wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery') );
- /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */
- function bp_dtheme_show_home_blog() {
- global $bp, $query_string, $paged;
- if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) {
- unset( $query_string );
- if ( ( 'page' == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, 'paged' ) ) {
- $query_string .= '&paged=' . $bp->action_variables[0];
- $paged = $bp->action_variables[0];
- }
- query_posts($query_string);
- bp_core_load_template( 'index', true );
- }
- }
- add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
- /*let us keep an eye on the site_url*/
- add_filter("site_url","my_custom_register_url",10,3);
- function my_custom_register_url($url, $path, $orig_scheme)
- { /*if the site url is used in login contentxt,let us check for the register link*/
- if($orig_scheme=="login")
- {
- if($path=="wp-login.php?action=register")//so it is a registration link..cool
- return get_option('siteurl')."/".BP_REGISTER_SLUG;//let us send it to our buddypress registration page
- }
- return $url;
- }
- if(is_admin())
- include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'theme-admin/admin.php');
- //for logo, topbar logo and bottombar log
- $cb_logo=get_option("cb_cb_header_logo");
- $cb_topbar_logo=get_option("cb_cb_topbar_logo");
- $cb_bottombar_logo=get_option("cb_cb_bottombar_logo");
- if(empty($cb_logo))
- $cb_logo=get_stylesheet_directory_uri()."/_inc/images/logo-big.gif";
- if(empty($cb_topbar_logo))
- $cb_topbar_logo=get_stylesheet_directory_uri()."/_inc/images/topbar_logo.gif";
- if(empty($cb_bottombar_logo))
- $cb_bottombar_logo=get_stylesheet_directory_uri()."/_inc/images/bottombar_logo.gif";
- /*** This was removed by Bp 1.2
- */
- function cb_get_the_body_class( $wp_classes, $custom_classes ) {
- global $bp;
- if ( bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page() )
- $bp_classes[] = 'blog-page';
- if ( !bp_is_blog_page() && !bp_is_register_page() && !bp_is_activation_page() )
- $bp_classes[] = 'internal-page';
- /* Merge WP classes with BP classes */
- $classes = array_merge( (array) $bp_classes, (array) $wp_classes );
- /* Remove any duplicates */
- $classes = array_unique( $classes );
- return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
- }
- add_filter( 'body_class', 'cb_get_the_body_class', 11, 2 );
- add_action("wp","add_sextra_nav");
- function add_sextra_nav(){
- global $bp;
- $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';
- $bp->bp_options_nav[$bp->groups->slug]["create"] = array(
- 'name' => "Create",
- 'link' => $groups_link . '/',
- 'slug' => $slug,
- 'css_id' => $item_css_id,
- 'position' => 100,
- 'user_has_access' => $user_has_access
- );
- print_r($bp->options_nav);
- /* Add the subnav items to the groups nav item */
- //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' ) );
- //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() ) );
- }
- function sh_walled_garden()
- {
- global $bp;
- if( bp_is_register_page() || bp_is_activation_page() )
- return;
- if( ! bp_is_blog_page() && ! is_user_logged_in() )
- bp_core_redirect( $bp->root_domain .'/'. BP_REGISTER_SLUG );
- }
- add_action( 'get_header', 'sh_walled_garden' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement