sokalsondha Posted June 1, 2019 Share Posted June 1, 2019 hello community hope we all doing well. i just need bit help if you can help me with that. i think i need a hock to remove some menu item from the homepage i need to remove the Store Menu item and the Announcement. can someone guide me with the hook so i can remove them 🙂 thanks in advance everyone 🙂 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 1, 2019 Share Posted June 1, 2019 It's all written here. TL;DR version below. Place this hook in your includes/hook directory. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook(ClientAreaPrimaryNavbar, 1, function(MenuItem $primaryNavbar) { $primaryNavbar = Menu::primaryNavbar(); $primaryNavbar->removeChild('Store'); $primaryNavbar->removeChild('Announcements'); }); 2 Quote Link to comment Share on other sites More sharing options...
sokalsondha Posted June 1, 2019 Author Share Posted June 1, 2019 21 minutes ago, Kian said: It's all written here. TL;DR version below. Place this hook in your includes/hook directory. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook(ClientAreaPrimaryNavbar, 1, function(MenuItem $primaryNavbar) { $primaryNavbar = Menu::primaryNavbar(); $primaryNavbar->removeChild('Store'); $primaryNavbar->removeChild('Announcements'); }); superrrr. its works really nice.. but sir i stil see the View Cart button in homepage ... i want to remove that too.. can you please help me with that . which file i need to edit basically we dont want any one register by themself.. admin register client with product.. thanks again for wonderful help 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 1, 2019 Share Posted June 1, 2019 You can remove that button multiple ways. With CSS in templates/{YOUR_TEMPLATE/css/custom.css: ul.top-nav > li.primary-action { display: none; } Removing or commenting from templates/{YOUR_TEMPLATE}/header.tpl this section of code: <li class="primary-action"> <a href="{$WEB_ROOT}/cart.php?a=view" class="btn"> {$LANG.viewcart} </a> </li> With an action hook: <?php add_hook('ClientAreaHeadOutput', 1, function($vars) { return '<style>ul.top-nav > li.primary-action { display: none; }</style>'; }); I suggest you to use the first two options. Since you're editing template make sure that the folder of your template has a custom name (not "six") otherwise you're gonna lose changes with updates. 1 Quote Link to comment Share on other sites More sharing options...
sokalsondha Posted June 1, 2019 Author Share Posted June 1, 2019 2 minutes ago, Kian said: You can remove that button multiple ways. With CSS in templates/{YOUR_TEMPLATE/css/custom.css: ul.top-nav > li.primary-action { display: none; } Removing or commenting from templates/{YOUR_TEMPLATE}/header.tpl this section of code: <li class="primary-action"> <a href="{$WEB_ROOT}/cart.php?a=view" class="btn"> {$LANG.viewcart} </a> </li> With an action hook: <?php add_hook('ClientAreaHeadOutput', 1, function($vars) { return '<style>ul.top-nav > li.primary-action { display: none; }</style>'; }); I suggest you to use the first two options. Since you're editing template make sure that the folder of your template has a custom name (not "six") otherwise you're gonna lose changes with updates. thankssssssssssssssssss boss... i use the hook.. and works straight.. you just made my day 🙂 god bless you all the time 🙂 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 1, 2019 Share Posted June 1, 2019 7 hours ago, Kian said: It's all written here. TL;DR version below. Place this hook in your includes/hook directory. just in passing, I should mention that you should ideally check if a menu item exists before removing or modifying it, because if there were another hook (current or future) that tries to modify that same child in some way, there are circumstances where that would show an error. 🙂 9 hours ago, sokalsondha said: i need to remove the Store Menu item and the Announcement. if you were just wanting to remove (hide) a menu item, using CSS in custom.css would be applicable too. #Primary_Navbar-Store, #Primary_Navbar-Announcements { display: none; } 0 Quote Link to comment Share on other sites More sharing options...
PeterCo Posted May 19, 2021 Share Posted May 19, 2021 Hi, How can I remove the "Open Ticket" links in the navbar and sidepanel in Twenty-One? I'm using my own ticket system, and this confuses customers. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.