I am using xamin handlebars WordPress plugin and I want to call #invoke helper function recursively.

Link to handlebars plugin: https://github.com/mardix/Handlebars

This is how render_menu should be define:

{{#define menu}}
    <li>
        {{label}}
        {{#if submenu}}
            <ul>
                {{#each submenu}} 
                    {{#invoke menu}}
                {{/each}}
            </ul>

        {{/if}}
    </li>
{{/define}}

And I should invoke it by:

<ul>
{{#each menus}}
     {{#invoke menu}}
  {{/each}}
</ul>

Read more here: How to make a resursion call for #invoke in #define?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: