How to programmatically add a custom item to the frontend main menu?

See also: