{"id":33,"date":"2020-03-31T11:48:15","date_gmt":"2020-03-31T11:48:15","guid":{"rendered":"https:\/\/docs.theironnetwork.org\/hulk\/?page_id=33"},"modified":"2020-04-13T11:45:05","modified_gmt":"2020-04-13T11:45:05","slug":"adding-menu-item","status":"publish","type":"page","link":"https:\/\/docs.theironnetwork.org\/hulk\/adding-menu-item\/","title":{"rendered":"Adding Menu Item"},"content":{"rendered":"\n<h5>Adding a New Menu Element\/Component In SideBar Menu <\/h5>\n\n\n\n<p> You can follow the steps given below to add a new menu element in the sidebar of your template. This sidebar element is added by default in both your <strong>default<\/strong> and <strong>mini sidebar<\/strong> layout. <\/p>\n\n\n\n<p> <strong>Step 1:<\/strong> Open <code>src-&gt;assets-&gt;data-&gt;menuitems.json<\/code> file. You need to add the new object as mentioned in the following code: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n    \"menu_title\":\"sidebar.newModules\",\n    \"path\":\"javascript:void(0)\",\n    \"icon\":\"error_outline\",\n    \"category\":\"general\",\n    \"isMenuOpen\":false,\n    \"menu\":\"newModules\",\n    \"fullPageMenu\":false,\n    \"desc\":true,\n    \"content\":\"\",\n    \"child_routes\":[\n       {\n          \"menu_title\":\"sidebar.newModules1\",\n          \"path\":\"\/newModules\",\n          \"child_routes\":null,\n          \"icon\":\"policy\",\n          \"fullPageMenu\":false,\n          \"isMenuOpen\":false,\n          \"third_child_routes\":null,\n          \"exact\":true\n       }\n    ]\n }<\/pre>\n\n\n\n<p> <strong>Step 2:<\/strong> Now open <code>src-&gt;lang-&gt;locales-&gt;en_US.js<\/code> file and add the new item under the export method. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">export default {\n    \"sidebar.newModule\" : \"New Modules\",\n    \"sidebar.dashboard\" : \"Dashboard\",\n    ....<\/pre>\n\n\n\n<p> The example is given above only adds the new menu item in the English locale, if you are using any different locale for your template then you need to specify the newly created category in that locale file also.  You can find different locale files under the folder <code>src-&gt;lang-&gt;locales<\/code> . <\/p>\n\n\n\n<p> After following the steps explained above, open the browser window and you can see your newly added menu item in the template. Refer the  example image below: <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"484\" src=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/03\/Hulk-Reactjs-Redux-Material-Design-Admin-Template-1024x484.png\" alt=\"\" class=\"wp-image-44\" srcset=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/03\/Hulk-Reactjs-Redux-Material-Design-Admin-Template-1024x484.png 1024w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/03\/Hulk-Reactjs-Redux-Material-Design-Admin-Template-300x142.png 300w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/03\/Hulk-Reactjs-Redux-Material-Design-Admin-Template-768x363.png 768w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/03\/Hulk-Reactjs-Redux-Material-Design-Admin-Template.png 1349w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption> Template with Newly Added Menu <\/figcaption><\/figure>\n\n\n\n<h4>Adding a New Menu Element\/Component In Horizontal Layout <\/h4>\n\n\n\n<p> You can follow the steps given below to add a new menu element in the horizontal menu. <\/p>\n\n\n\n<p> <strong>Step 1:<\/strong> Open <code>src-&gt;assets-&gt;data-&gt;menuitems.json<\/code> file. You need to add the new object as mentioned in the following code:  <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> {\n    \"menu_title\":\"sidebar.newModules\",\n    \"path\":\"javascript:void(0)\",\n    \"icon\":\"error_outline\",\n    \"category\":\" newModules \",\n    \"isMenuOpen\":false,\n    \"menu\":\"newModules\",\n    \"fullPageMenu\":false,\n    \"desc\":true,\n    \"content\":\"\",\n    \"child_routes\":[\n       {\n          \"menu_title\":\"sidebar.newModules1\",\n          \"path\":\"\/newModules\",\n          \"child_routes\":null,\n          \"icon\":\"policy\",\n          \"fullPageMenu\":false,\n          \"isMenuOpen\":false,\n          \"third_child_routes\":null,\n          \"exact\":true\n       }\n    ]\n } <\/pre>\n\n\n\n<p>Just change the category if you want to add new items in new dropdown otherwise you can add in general and other categories.<\/p>\n\n\n\n<p> <strong>Step 2: <\/strong>Open<code>src-&gt;components-&gt;HorizontalMenu-&gt;HorizontalMenu.js<\/code> file &amp; search for the <strong>setCategory()<\/strong> method and make the changes explained in the screenshot given below: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">setCategory(){\n         let category1 = this.state.navLinks.filter((item, i) =&gt; {\n             return item.category === 'general';\n         })\n         ....\n         ....\n         let category5 = this.state.navLinks.filter((item, i) =&gt; {\n             return item.category === 'newModules';\n         })\n         this.setState({\n             general:category1,\n             ....\n             newModules: category5\n         }) \n}<\/pre>\n\n\n\n<p>After that add new state in <strong>render()<\/strong> method<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> render() {\n       const { general, ...., newModules } = this.state;\n       ....\n} <\/pre>\n\n\n\n<p>After that add new li structure in the return method<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"715\" height=\"251\" src=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/2020-04-01_09-19-10-1.png\" alt=\"\" class=\"wp-image-51\" srcset=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/2020-04-01_09-19-10-1.png 715w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/2020-04-01_09-19-10-1-300x105.png 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/figure>\n\n\n\n<p> After following the steps explained above, open the browser window and you can see your newly added menu item in the template. Refer the example image below:  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"484\" src=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/Hulk-Reactjs-Redux-Material-Design-Admin-Template1-1024x484.png\" alt=\"\" class=\"wp-image-54\" srcset=\"https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/Hulk-Reactjs-Redux-Material-Design-Admin-Template1-1024x484.png 1024w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/Hulk-Reactjs-Redux-Material-Design-Admin-Template1-300x142.png 300w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/Hulk-Reactjs-Redux-Material-Design-Admin-Template1-768x363.png 768w, https:\/\/docs.theironnetwork.org\/hulk\/wp-content\/uploads\/sites\/13\/2020\/04\/Hulk-Reactjs-Redux-Material-Design-Admin-Template1.png 1349w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Template with newly added menu<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Adding a New Menu Element\/Component In SideBar Menu You can follow the steps given below to add a new menu element in the sidebar of your template. This sidebar element is added by default in both your default and mini sidebar layout. Step 1: Open src-&gt;assets-&gt;data-&gt;menuitems.json file. You need to add the new object as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/pages\/33"}],"collection":[{"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":18,"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/pages\/33\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/pages\/33\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/docs.theironnetwork.org\/hulk\/wp-json\/wp\/v2\/media?parent=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}