您好,我想通过WordPress菜单添加一个链接,以转到Buddypress的“个人资料”标签,以及登录用户的第二菜单。
示例链接类似于site / members / {usernamehere} / my-profile-menu / test /
根据另一本在线指南,我能够添加my-profile-menu部分,但希望将其子链接添加到主WordPress菜单中的选项卡上。
答案 0 :(得分:1)
您可以使用“ me”作为用户名为登录用户创建动态的BuddyPress配置文件链接。
示例:First create list of Tuples which contains numbers and corresponds.
Then a method/loops to iterate and return result.
IEnumerable<Tuple<int, string>> data = new List<Tuple<int, string>>()
{
new Tuple<int, string>( 1, "I"),
new Tuple<int, string>( 4, "IV" ),
new Tuple<int, string>( 5, "V" ),
new Tuple<int, string>( 9, "IX" ),
new Tuple<int, string>( 10, "X" ),
new Tuple<int, string>( 40, "XL" ),
new Tuple<int, string>( 50, "L" ),
new Tuple<int, string>( 90, "XC" ),
new Tuple<int, string>( 100, "C" ),
new Tuple<int, string>( 400, "CD" ),
new Tuple<int, string>( 500, "D" ),
new Tuple<int, string>( 900, "CM"),
new Tuple<int, string>( 1000, "M" )
};
public string ToConvert(decimal num)
{
data = data.OrderByDescending(o => o.Item1).ToList();
List<Tuple<int, string>> subData = data.Where(w => w.Item1 <= num).ToList();
StringBuilder sb = new StringBuilder();
foreach (var item in subData)
{
if (num >= item.Item1)
{
while (num >= item.Item1)
{
num -= item.Item1;
sb.Append(item.Item2.ToUpper());
}
}
}
return sb.ToString();
}