How to display an image in dropdown of navigation menu bar

How to display an image in dropdown of navigation menu bar

September 4, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to display an image in dropdown of navigation menu bar

Displaying Images in Magento Navigation Menu Bar

In this post, we’ll walk through how to display images within your navigation menu dropdowns in Magento.

Understanding the Problem

Firstly, let’s clarify the issue you’re facing. You want to include an image next to each subcategory item in your custom navigation menu. Currently, when you modify the static block as suggested here, it only works for the default Magento menu and not for your modified version that displays all subcategories.

The Solution Approach

To solve this, we’ll need to:

  1. Create a static block containing the image.
  2. Modify the category view to include our static block.
  3. Ensure the layout is set up correctly for our custom navigation.

Step-by-Step Guide

1. Creating the Static Block with Image

Go to Content > Widgets and click on “Add new widget”. Choose “CMS Static Blocks” as your widget type.

Fill in the details:

  • Title: Menu_Image
  • Identifier: menu_image_block

In the content field, use the following code:

<div class="category-image">
    <img src="{{media url="wysiwyg/your_image.jpg"}}"/>
</div>

Replace your_image.jpg with your actual image filename.

2. Modifying Category View

Next, we need to include this static block in our category view. Go to Design > Layout Update XML.

Under “Layout Update XML”, enter the following:

<reference name="catalog.category.view">
    <block type="cms/static_block" before="-" template="Magento_Theme::html/cms/block.phtml"/>
</reference>

This code tells Magento to insert our static block (menu_image_block) before the content of category pages.

3. Setting Up Layout for Custom Navigation

Ensure your custom navigation layout has the following:

<reference name="catalog.topnav">
    <action method="setUseAuthUrl"><argument name="use_auth_url" xsi:type="string">1</argument></action>
    <block type="core/text_list" name="topmenu" as="topMenu" before="-" template="page/html/topmenu.phtml">
        <action method="setIdPrefix" xsi:type="string">topmenu-</action>
        <block type="page/html_link" />
        <block type="cms/static_block" template="Magento_LandingPage::landing-block.phtml"/>
    </block>
</reference>

This includes the cms/static_block in your top navigation menu.

Conclusion

By following these steps, you should now be able to display images within your custom Magento navigation dropdowns. Remember that the image path ({{media url="wysiwyg/your_image.jpg"}}) needs to point to a valid media file in your Magento installation.

This approach uses built-in Magento functionality and avoids having to modify core files or rely on extensions. It’s a clean, developer-friendly method for customizing your store’s layout.

For more advanced navigation customization techniques, consider checking out our post on dynamic menu creation which goes into greater depth about managing complex nav structures.

Catalog Themes Errors CLI

Our network