2

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.

1 Answer 1

3

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 
   }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.