How to Check if Category is in Top Navigation in Magento

category

Is there a magic function for checking if a category is included in the top navigation and if not what is the correct way to check programmatically?
I've come across a few possible ones online such as

   getIncludeInMenu()

but none seem to work on the site I'm working on at the moment so I would appreciate a concrete answer.

P.s. I would have checked the file that the top menu is being rendered from but for some reason I'm having a nightmare trying to find it.

Best Answer

Ok so found a solution.

I just loaded the full category object

   $category->load()

(as a side note, loading the full thing isn't a great idea in terms of implementation but it's a good way to see all of the attributes)

and then saw that it had this attribute [INCLUDE_IN_MENU] and I just used this to find out if a category is part of the top nav or not by

   if($child['include_in_menu'}){
       //do the business 
   }
Related Topic