If you need to customize your menu items, for example attach an icon to each item, you can use the wpak_navigation_items filter.

On PHP side (in a php file in your app theme’s php folder) :

add_filter( 'wpak_navigation_items', 'wpak_add_menu_icons', 10, 2 );
function wpak_add_menu_icons( $menu_items, $app_slug ) {

    //Each menu item correspond to a component.
    // > We target each menu item by its component's slug
    // and add an "icon" entry to each menu item:
    $menu_items["my-item's-component-slug"]["icon"]  = "/my/icon/url";
    $menu_items["my-other-component-slug"]["icon"]  = "/my/other/icon/url";
    
    return $menu_items;
}

Then on your app theme’s side, in menu.html template:

<% _.each( menu_items, function( menu_item ){ %>

            <% //use menu_item.icon to display your icon %>

<% }) %>

 

Published by Mathieu on March 13, 2018

Freelance Senior Web Developer, WordPress since 2009, JS/Backbone since 2012, Custom Back-End devs, WebApps and Plugins for clients and the community.

Leave a Reply

Your email address will not be published. Required fields are marked *

Having questions?

FAQ | Tutorials | Documentation

Or

Contact Us