从category.template.php找到此说明:
/**
* Retrieve category link URL.
*
* @since 1.0.0
* @see get_term_link()
*
* @param int|object $category Category ID or object.
* @return string Link on success, empty string if category does not exist.
*/
function get_category_link( $category ) {
if ( !is_object($category) )
$category = (int) $category;
$category = get_term_link( $category, 'category' );
if ( is_wp_error( $category ) )
return '';
return $category;
}
我不确定如何将这段代码用于用户页面上的链接:
$bp->bp_nav[117]=array ( 'name' => 'Biography'
,'LINK SHOULD GO HERE' => 'LINK SHOULD GO HERE/'
, 'css_id' => 'Biography'
, 'show_for_displayed_user' => 1
,'position' => 117 );
add_action("wp","add_sextra_nav");
有关如何让两者一起工作的任何建议吗?
答案 0 :(得分:0)
您仍需要从某处插入类别名称或ID:
$bp->bp_nav[117] = array(
'name' => 'Biography',
'category_link' => get_category_link(get_cat_ID('CATEGORY_NAME_HERE')),
'css_id' => 'Biography',
'show_for_displayed_user' => 1,
'position' => 117,
);
add_action('wp', 'add_sextra_nav');
基于http://codex.wordpress.org/Function_Reference/get_category_link
的示例的示例