Reputation: 3289
I am using https://github.com/rkhleics/wagtailmenus for my Django Wagtail menus, but can't seem to figure out how to use a custom template for my flat_menu
. I followed the guides but I think I may be doing something wrong.
My flat_menu template is in a directory menus/top_sub_menu.html
, where top_sub_menu
is the handle of the menu I created.
top_sub_menu.html
{% load menu_tags %}
{% if menu_items %}
<ul class="c-links c-theme-ul">
{% for item in menu_items %}
<li>
<a href="{{ item.href }}">{{ item.text }}</a> {% if item.has_children_in_menu %}{% sub_menu item %}{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
header.html
{% load menu_tags %}
...
{% flat_menu 'top_sub_menu' %}
...
I have a custom main_menu.html
and a sub_menu.html
in the same directory and they work, so I know my menu directory is in correct location. Thank you.
Upvotes: 0
Views: 996
Reputation: 263
The template location behaviour described in the README for the {% flat_menu %}
tag (https://github.com/rkhleics/wagtailmenus#4-using-the--flat_menu--tag) was only introduced in version 2.2.0
. You should be able to use your custom template by utilising the template
argument, though. For example:
In header.html
{% load menu_tags %}
...
{% flat_menu 'top_sub_menu' template="menus/top_sub_menu.html" %}
...
Upvotes: 1