Integrating Navigation into Your Theme
Merchants possess the ability to craft menus for navigation within their store, which can be structured hierarchically to form dropdown menus.
In this tutorial, you'll learn how to incorporate navigation into your theme.
Resources
Implementation of Navigation
To integrate navigation into your theme, follow these steps:
-
Create Navigation Menus: Navigate to Online Store > Navigation Menus in the SHOPLINE backend and generate your navigation menus.
-
Access Navigation Menus: Once your navigation menus are created, you can access them within your store using the
linklists
global object. SHOPLINE furnishes amenu_picker
menu picker, allowing merchants to designate menus themselves. You can reference the menu by its assigned name.
...
{
"settings": [
{
"type": "menu_picker",
"id": "main_menu_link_list",
"label": "Navigation Menu",
"default": "Main Menu"
}
]
}
- Output Menu Links: For each menu link, output pertinent information such as title and URL. For instance, if you've established a menu navigation named
main_menu_link_list
and merchants can select the menu they desire to employ in the header section, the following code snippet illustrates how you might output the menu.
<ul class="menu">
<li class="menu-link">
<a href=""></a>
</li>
</ul>
The provided example serves to showcase the iteration through the navigation menu and the output of links. It doesn't encompass complete navigation functionality.
Implementation of Multi-level Navigation
In certain scenarios, you may desire to output child links for the links. You can nest up to three levels of links, accessible via the links
property object.
<ul class="menu">
<ul class="menu dropdown__secondary">
<ul class="menu dropdown__child">
<li class="menu__link">
<a href=""></a>
</li>
</ul>
<li class="menu__link">
<a href=""></a>
</li>
</ul>
<li class="menu__link">
<a href=""></a>
</li>
</ul>
Depending on the type of navigation you're constructing, include the navigation menu either in the header or footer section.
Error loading component.