Skip to product information
1 of 1
Published:2026.04.04

Display a Banner Image at the Top of the Horizon Theme Drawer Menu

Display a Banner Image at the Top of the Horizon Theme Drawer Menu

Applications

  • メニュー編集
View full details

This customization displays a banner image at the top of the Horizon theme's drawer menu (hamburger menu). The banner image and link can be configured from the theme editor's "Drawer Banner" settings, and the configuration is preserved through theme updates. CSS loading uses the custom.globals.liquid snippet pattern, keeping changes to theme.liquid to a single line for a safe implementation.


Result

Tapping the hamburger icon opens the drawer, displaying a banner image above the menu items. Adding a destination link allows you to direct customers to coupon pages or featured pages.

Banner image displayed at the top of the Horizon theme drawer menu


Theme Editor Settings

After implementation, you can set the image and link destination from the "Drawer Banner" section in the theme editor's Menu block without touching any code.

Theme editor drawer banner settings panel showing image and link configuration


Implementation Steps

5 files need to be created or modified. The only change to theme files is a single line in theme.liquid — all other changes are new files or additions to existing files.


① layout/theme.liquid — Add 1 line at L30

Add the custom.globals render tag immediately after the stylesheets snippet. This is the only change to theme files.

Code showing the custom.globals render tag added at L30 of layout/theme.liquid


② snippets/custom.globals.liquid — Create new file

An intermediary snippet that loads custom.css and custom.js. This pattern keeps the change to theme.liquid to a single line, while allowing future customizations to be managed through this snippet.

Full code of snippets/custom.globals.liquid loading custom.css and custom.js


③ assets/custom.css — Create new file

Defines the banner styles. border-radius uses a theme CSS variable to follow the theme's corner radius setting.

Full code of assets/custom.css defining drawer banner styles


④ blocks/_header-menu.liquid — Add schema settings

Add banner image and link settings to the end of the settings array (immediately after drawer_dividers).

Code showing drawer_banner schema settings added to blocks/_header-menu.liquid


⑤ snippets/header-drawer.liquid — Add banner display code

Insert the banner display code immediately after the close button (</button>), just before the <nav> tag. When a link is set, it wraps the image in an <a> tag; otherwise it shows the image without a link.

Banner display code inserted before the nav tag in snippets/header-drawer.liquid


Translation Keys

Add translation keys for t:content.drawer_banner / t:settings.drawer_banner_image / t:settings.drawer_banner_link to locale files.


locales/en.default.schema.json — Add to content / settings objects.

locales/ja.schema.json — Add to content / settings objects in the same way (translation key values are included in the code).


Note: About the custom.globals.liquid Pattern

While there are several ways to add custom CSS to a theme, writing <link> tags directly in theme.liquid creates diffs that are hard to manage during theme updates. By using a custom.globals.liquid snippet as an intermediary, you can limit changes to theme.liquid to a single line: {%- render 'custom.globals' -%}. If you want to add custom JS in the future, you only need to modify custom.globals.liquid.


Note: About the menu-drawer__animated-element Class

The menu-drawer__animated-element class is added to the banner element to apply the Horizon theme's standard drawer animation (fade-in or slide-up) to the banner as well. --menu-drawer-animation-index: 0 sets the animation order to first (0th), so the banner animates before the menu items.


After making a purchase (all items are ¥0), you will be able to view the sample code.

If you have already made a purchase, please login here.

Sample Codes

Test Theme :Horizon 3.4.0

① layout/theme.liquid — L30 に1行追加

② snippets/custom.globals.liquid — 新規作成

③ assets/custom.css — 新規作成