{"id":3266,"date":"2015-07-14T12:50:17","date_gmt":"2015-07-14T11:50:17","guid":{"rendered":"https:\/\/www.megamenu.com\/?page_id=3266"},"modified":"2023-10-04T11:57:33","modified_gmt":"2023-10-04T10:57:33","slug":"manual-php","status":"publish","type":"ht_kb","link":"https:\/\/www.megamenu.com\/documentation\/manual-php\/","title":{"rendered":"Manual Integration (PHP)"},"content":{"rendered":"\n<p>As Max Mega Menu overrides the standard WordPress function to output a menu location, no special configuration or theme setup is required.<\/p>\n\n\n\n<p>We simply need to output a menu using the standard WordPress method.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Registering a new menu location<\/h3>\n\n\n\n<p>First we&#8217;ll need to create a new menu location. If you already have a menu location registered you can skip this step.<\/p>\n\n\n\n<p>Under<em>&nbsp;Mega Menu &gt; Menu Locations<\/em>, click the &#8220;Add another menu location&#8221; link and rename the location to something suitable.<\/p>\n\n\n\n<p>In our case we&#8217;ll rename the location to &#8220;Header Menu&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2646\" height=\"1692\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations.png?bust\" alt=\"Screenshot of Max Mega Menu locations page\" class=\"wp-image-20804\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations.png 2646w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations-300x192.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations-768x491.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations-1024x655.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/menu-locations-50x32.png 50w\" sizes=\"auto, (max-width: 2646px) 100vw, 2646px\" \/><\/a><\/figure>\n\n\n\n<p>We now have a new menu location which we will output within our theme using PHP.<\/p>\n\n\n\n<p>Tip: Advanced users may prefer to register a new menu location using the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_nav_menu\/\">register_nav_menu<\/a> function.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Assigning a menu to the new location<\/h3>\n\n\n\n<p>Under <em>Appearance &gt; Menus<\/em>, create a new menu and assign it to the new menu location.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2646\" height=\"1692\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2.png\" alt=\"\" class=\"wp-image-214007\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2.png 2646w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2-300x192.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2-768x491.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2-1024x655.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-2-50x32.png 50w\" sizes=\"auto, (max-width: 2646px) 100vw, 2646px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Outputting the menu location<\/h3>\n\n\n\n<p>We have now registered a menu location, tagged a menu to that location and enabled MMM for that location. All we need to do now is output the menu in our theme template files.<\/p>\n\n\n\n<p>Head back to <em>Mega Menu &gt; Menu Locations<\/em> and expand the new menu location. Inside we will find the PHP code to use to output the menu location:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2646\" height=\"1692\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3.png\" alt=\"\" class=\"wp-image-214008\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3.png 2646w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3-300x192.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3-768x491.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3-1024x655.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-3-50x32.png 50w\" sizes=\"auto, (max-width: 2646px) 100vw, 2646px\" \/><\/a><\/figure>\n\n\n\n<p>You can paste this code anywhere into your theme template files. Usually it is placed within the header.php file. In our case we&#8217;re using the WordPress theme editor (you can use your own text editor if you prefer), and have pasted the code just after the opening &lt;body&gt; tag:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2646\" height=\"1692\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4.png\" alt=\"\" class=\"wp-image-214009\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4.png 2646w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4-300x192.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4-768x491.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4-1024x655.png 1024w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2015\/07\/manual-integration-4-50x32.png 50w\" sizes=\"auto, (max-width: 2646px) 100vw, 2646px\" \/><\/a><\/figure>\n\n\n\n<p>Save the file and the menu will now be output on your site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As Max Mega Menu overrides the standard WordPress function to output a menu location, no special configuration or theme setup is required. We simply need to output a menu using the standard WordPress method. Step 1: Registering a new menu location First we&#8217;ll need to create a new menu location&#8230;.<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"ht-kb-category":[17],"ht-kb-tag":[],"class_list":["post-3266","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-menu-output-options"],"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":"As Max Mega Menu overrides the standard WordPress function to output a menu location, no special configuration or theme setup is required. We simply need to output a menu using the standard WordPress method. Step 1: Registering a new menu location First we&#8217;ll need to create a new menu location....","_links":{"self":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/3266","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=3266"}],"version-history":[{"count":20,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/3266\/revisions"}],"predecessor-version":[{"id":397041,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/3266\/revisions\/397041"}],"wp:attachment":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/media?parent=3266"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-category?post=3266"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-tag?post=3266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}