{"id":99478,"date":"2016-12-26T21:23:48","date_gmt":"2016-12-26T21:23:48","guid":{"rendered":"https:\/\/www.megamenu.com\/documentation\/rtl-support-copy\/"},"modified":"2021-12-15T10:57:27","modified_gmt":"2021-12-15T10:57:27","slug":"shortcode-in-menu","status":"publish","type":"ht_kb","link":"https:\/\/www.megamenu.com\/documentation\/shortcode-in-menu\/","title":{"rendered":"How to display shortcodes in menu items"},"content":{"rendered":"<p><em>Please note this guide uses the &#8220;Replacements&#8221; functionality which is a feature of Max Mega Menu Pro.<\/em><\/p>\n<p>In this example we will demonstrate how to display a shortcode\u00a0alongside existing top level menu items.<\/p>\n<p>For the purposes of this demonstration, we&#8217;ll use the <span class=\"lang:default decode:true crayon-inline\">[currency_switcher]<\/span>\u00a0 shortcode. <strong>This shortcode is available if you are using the WPML WooCommerce Multi Lingual plugin.<\/strong><\/p>\n<h3>Step 1 &#8211; Add a new item to the menu<\/h3>\n<p>Create a new Custom Link menu item and position the item within the menu where you would like the shortcode to be displayed.<\/p>\n<p>Set the title of the Custom Link to &#8220;Currency Switcher&#8221; and the URL to &#8220;http:\/\/#&#8221;.<\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99480\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1.png\" alt=\"\" width=\"2692\" height=\"1642\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1.png 2692w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1-300x183.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1-768x468.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1-1024x625.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-1-50x30.png 50w\" sizes=\"auto, (max-width: 2692px) 100vw, 2692px\" \/><\/a><\/p>\n<h3>Step 2 &#8211; Set up the shortcode replacement<\/h3>\n<p>Save the menu, then hover over the &#8220;Currency Switcher&#8221; item and click the blue Mega Menu button.<\/p>\n<p>Go to the &#8220;Replacements&#8221; tab and set the Type to &#8220;HTML&#8221; and mode to &#8220;Replace the whole menu item link&#8221;.<\/p>\n<p>Paste the shortcode into the HTML text area.<\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99481\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2.png\" alt=\"\" width=\"2692\" height=\"1642\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2.png 2692w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2-300x183.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2-768x468.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2-1024x625.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-2-50x30.png 50w\" sizes=\"auto, (max-width: 2692px) 100vw, 2692px\" \/><\/a><\/p>\n<h3>Step 3 &#8211; The result<\/h3>\n<p>The custom menu item has been replaced with the shortcode:<\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99482\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3.png\" alt=\"\" width=\"2692\" height=\"1642\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3.png 2692w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3-300x183.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3-768x468.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3-1024x625.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-3-50x30.png 50w\" sizes=\"auto, (max-width: 2692px) 100vw, 2692px\" \/><\/a><\/p>\n<p>We can continue to use the mega menu settings for the item, including aligning the item to the right hand side of the menu:<\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99483\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4.png\" alt=\"\" width=\"2692\" height=\"1642\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4.png 2692w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4-300x183.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4-768x468.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4-1024x625.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-4-50x30.png 50w\" sizes=\"auto, (max-width: 2692px) 100vw, 2692px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99484\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5.png\" alt=\"\" width=\"2692\" height=\"1642\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5.png 2692w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5-300x183.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5-768x468.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5-1024x625.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2016\/12\/shortcode-in-menu-5-50x30.png 50w\" sizes=\"auto, (max-width: 2692px) 100vw, 2692px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Please note this guide uses the &#8220;Replacements&#8221; functionality which is a feature of Max Mega Menu Pro. In this example we will demonstrate how to display a shortcode\u00a0alongside existing top level menu items. For the purposes of this demonstration, we&#8217;ll use the [currency_switcher]\u00a0 shortcode. This shortcode is available if you&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"ht-kb-category":[14],"ht-kb-tag":[],"class_list":["post-99478","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-faqs"],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"Tom Hemsley","author_link":"https:\/\/www.megamenu.com\/author\/megamenu\/"},"uagb_comment_info":0,"uagb_excerpt":"Please note this guide uses the &#8220;Replacements&#8221; functionality which is a feature of Max Mega Menu Pro. In this example we will demonstrate how to display a shortcode\u00a0alongside existing top level menu items. For the purposes of this demonstration, we&#8217;ll use the [currency_switcher]\u00a0 shortcode. This shortcode is available if you...","_links":{"self":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/99478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/comments?post=99478"}],"version-history":[{"count":9,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/99478\/revisions"}],"predecessor-version":[{"id":323375,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/99478\/revisions\/323375"}],"wp:attachment":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/media?parent=99478"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-category?post=99478"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-tag?post=99478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}