You can keep the language links dynamically generated by Polylang without writing custom PHP.
What I meant is to place the existing Polylang Language Switcher element inside a regular Bricks Dropdown:
- Add a Bricks Dropdown and use “Languages” as its label, for example.
- Remove its placeholder links and change the inner Content container’s HTML tag from
ul to div, since the language switcher provides its own list.
- Insert the Polylang Language Switcher into that container, disable its Dropdown option, and set its direction to vertical.
- Keep Force home disabled, so Polylang links to the corresponding translations rather than always linking to the language homepages. Enable Hide if no translation if you only want to show available translations.
The outer Bricks Dropdown provides the toggle and arrow. The language switcher inside provides regular links, whose hover backgrounds you can style with CSS. For example, add this under the Language Switcher’s Style → CSS → Custom CSS:
%root% a:hover,
%root% a:focus-visible {
background-color: #eee;
}
This keeps Polylang responsible for generating the URLs, so you don’t need to maintain individual language links manually.
{"content":[{"id":"pldrop","name":"dropdown","parent":"pldemo","settings":{"tag":"div","text":"Languages","toggleOn":"click","ariaLabel":"Choose language","contentWidth":"240px","_width":"max-content","_typography":{"color":{"hex":"#172554"}},"_cssCustom":"#brxe-pldrop>.brx-submenu-toggle {\n padding: 12px 16px;\n border: 1px solid #94a3b8;\n border-radius: 8px;\n background-color: #fff;\n}\n#brxe-pldrop>.brx-dropdown-content {\n background-color: #fff;\n border: 1px solid #94a3b8;\n border-radius: 8px;\n padding: 8px;\n box-shadow: 0 8px 24px rgb(0 0 0 / 12%);\n}"},"children":["plcont"]},{"id":"plcont","name":"div","parent":"pldrop","settings":{"tag":"div","_hidden":{"_cssClasses":"brx-dropdown-content"}},"label":"Dropdown content (div)","children":["pllang"]},{"id":"pllang","name":"polylang-language-switcher","parent":"plcont","settings":{"direction":"column","showNames":true,"hideIfNoTranslation":true,"hideIfEmpty":false,"_width":"100%","_gap":"4px","_cssCustom":"#brxe-pllang {\n margin: 0;\n}\n#brxe-pllang li {\n width: 100%;\n list-style: none;\n}\n#brxe-pllang a {\n display: flex;\n padding: 12px 16px;\n border-radius: 4px;\n color: #172554;\n text-decoration: none;\n}\n#brxe-pllang a:hover {\n background-color: #dbeafe;\n color: #1e40af;\n}\n#brxe-pllang a:focus-visible {\n background-color: #dbeafe;\n color: #1e40af;\n}"},"label":"Dynamic Polylang links","children":[]}],"source":"bricksCopiedElements","sourceUrl":"https://bricks.local","version":"2.4.6"}