I can understand that hook_menu is for modules only, not custom themes. But if I want to add custom paths/urls to my theme what should I do?

For example if I want some of the content to load by ajax, and I want to use custom urls, then a "hook_menu" would be great for custom themes.

Surely there must be another solution than to write a small custom module?

Any suggestions and help is appreciated.


1 Answer 1


As of Drupal 7, themes can implement alter hooks, so you can use hook_menu_alter() in template.php.

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.