I want to override theme menu link items in my theme. I know that I must use theme_menu_link(array $variables) theme function.

But I want to know, is there any way that I can change the output render of theme_menu_link function based on region.

for example if menu link item is located in header region, it must be wrapped in div tag and if menu link item is located in footer region, it must be wrapped in li tag.

  • Is there any reason you can't just use CSS to change how the links look in each region? What is your end goal?
    – m.stenta
    May 16, 2016 at 12:14
  • yes, there is. because in header menu are simple li tag but in footer menu item includes some images and info that are loaded from database. so in second case, I need to run some codes that fetch data from database.
    – Mehrdad201
    May 16, 2016 at 16:09
  • Do it by targeting specific menus:drupal.stackexchange.com/questions/77714/…
    – ipwa
    Apr 20, 2018 at 10:04


Your Answer

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

Browse other questions tagged or ask your own question.