Skip to:
Content
Pages
Categories
Search
Top
Bottom

Moving Links around


  • leethompson
    Member

    @leethompson

    Hello Everyone,
    I am trying to move some links around from the main Nav to the sub nav ie:
    sub of Profile
    Privacy
    Settings

    Sub of MyGroups
    Create

    I have added the following code to my themes function.php and it moves the links as I want, but the first part bp_core_remove_nav_item seems to disable the page load.

    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );

    function bp_add_create_group_subnav() {
    global $bp;
    $groups_link = ‘/groups-2/’;
    $settings_link = $bp->loggedin_user->domain ;

    /* Add the subnav items to the groups nav item */
    if (function_exists(‘bp_core_new_subnav_item’)) {
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Create Clan’, ‘buddypress’ ),
    ‘slug’ => ‘create’,
    ‘parent_url’ => $groups_link,
    ‘parent_slug’ => $bp->groups->slug,
    ‘screen_function’ => ‘groups_screen_group_home’,
    ‘position’ => 40,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Settings’, ‘buddypress’ ),
    ‘slug’ => ‘settings’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Privacy’, ‘buddypress’ ),
    ‘slug’ => ‘privacy’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    }
    }
    add_action(‘groups_setup_nav’, ‘bp_add_create_group_subnav’);
    `
    I was wondering what I am doing wrong?

    thanks in advance.

Viewing 1 replies (of 1 total)

  • leethompson
    Member

    @leethompson

    ok, I found out if you remove a parent item the page(function) is removed too, So I removed this function:
    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );`

    and I used css to hide the parent item. In my themes main css I added :

    `#user-privacy {
    display: none !important;
    }

    #user-settings {
    display: none !important;

    }
    `

    Now I will write a javascript function to highlight the right parent item if I am in the proper section.

    Then i will try to write a bp global function to re-assign subnav items to different parent item.

Viewing 1 replies (of 1 total)
  • The topic ‘Moving Links around’ is closed to new replies.
Skip to toolbar