如何在buddypress中添加导航组中的新链接,并具有指定位置的能力?

时间:2017-04-03 08:25:53

标签: wordpress buddypress

如何在buddypress中添加导航组中的新链接并指定位置? 我尝试使用函数bp_core_create_nav_link(),但它不起作用

function a21_nav(){
global $bp;
// $bp = buddypress();
// buddypress()->groups->nav->add_nav( $args );

    $args = array(
    'name'                    => 'new_link21', // Display name for the nav item.
    'slug'                    => 'new_link21', // URL slug for the nav item.
    'link'                     => 'new_link21.ru',
    'item_css_id'             => 'we', // The CSS ID to apply to the HTML of the nav item.
    'show_for_displayed_user' => true,  // When viewing another user does this nav item show up?
    'site_admin_only'         => false, // Can only site admins see this nav item?
    'position'                => 99,    // Index of where this nav item should be positioned.
    'screen_function'         => 'a21_callback_sf', // The name of the function to run when clicked.
    'default_subnav_slug'     => false  // The slug of the default subnav item to select when clicked.
);
    // echo $args;

echo bp_core_create_nav_link( $args, $component = 'groups' );}

0 个答案:

没有答案