$six_weeks_ago = ($curr_weeknr + 51 - 6) % 52 + 1;
Или:
$date = new DateTime($date);
$date->modify("-42 days");
$six_weeks_ago = $date->format("W");
Используйте type => MENU_VISIBLE_IN_TREE
в определении пунктов подменю, чтобы они были видны только в меню, а не в крошке.
Флаги для типов пунктов меню определены в includes/menu.inc
. Там мы можем видеть, что флаг MENU_NORMAL_ITEM
берет свои биты из побитовой операции ИЛИ MENU_VISIBLE_IN_TREE
и MENU_VISIBLE_IN_BREADCRUMB
:
/**
* Menu type -- A "normal" menu item that's shown in menu and breadcrumbs.
*
* Normal menu items show up in the menu tree and can be moved/hidden by
* the administrator. Use this for most menu items. It is the default value if
* no menu item type is specified.
*/
define('MENU_NORMAL_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB);
Это означает, что флаг для MENU_NORMAL_ITEM
не отображается в крошке MENU_VISIBLE_IN_TREE
.