Jump to content
Sign in to follow this  
sokalsondha

want to remove menu item from the homepage

Recommended Posts

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

 

image.png.cf5ef0f1f482dbcd4f8d11cb5d52cb7b.png

 

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 🙂

Share this post


Link to post
Share on other sites

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');
});

 

Share this post


Link to post
Share on other sites
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

 

image.png.87530c06249375009e84ffbe0c8c7768.png

basically we dont want any one register by themself.. admin register client with product..

thanks again for wonderful help

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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 🙂

Share this post


Link to post
Share on other sites
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; }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By ramf
      Hi,
      Can someone please help me with this hook? 
      It was created by @brian!  and appeared here- but sadly he can't help me. 
      Since I'm selling mostly one time products - I have lots of inactive clients and I want to be able to find them easily without the hassle of  changing the search toggle.
      There it this feature request  that was opened 2 years ago to make the hide inactive clients optional (please vote) - but until this happens I have no choice but to use this hook:
       
      <?php add_hook('AdminAreaHeadOutput', 1, function($vars) { if ($vars['filename'] == 'clients' OR in_array($vars['pagetitle'], array(AdminLang::trans('services.title'), AdminLang::trans('services.listaddons'), AdminLang::trans('services.listdomains')))) { $autoPost = <<<HTML if ($('input#checkboxShowHidden').is(':checked')) { $('body').addClass('hidden'); $('#checkboxShowHidden').click(); } HTML; } return <<<HTML <script> $(document).on('ready', function() { if ($('input#intelliSearchHideInactiveSwitch').is(':checked')) { $('#intelliSearchHideInactiveSwitch').click(); } {$autoPost} }) </script> HTML; }); The problem with this one is that the search bar is always opened with this error - in every page loading:
      So even If i'm not clicking on the search field - the search bar is opened with this message.
      Can someone help me figure out what should be changed in this hook file so it will not open the search bar automatically - but when we do search we will see the inactive clients alongside the active onse?
      Thanks!
       

    • By Eldremor
      Hello, is there anyway via hook or modifying the php to add images before X configurable option name?
      Example:
    • By JesusSuarz
      sometimes the client can have 2 emails.
      one for your account details and one for the account owner.
      I need to know if the account owner's email is verified.
      The var: 
      $client = Menu::context("client"); gets the email that the customer has in the account details, however this is not the email owner of the account.
      I hope to make myself understood correctly.
       
    • By karlfrankeser
      Hello,
      I am new to this community!
      I am setting up a hook that allows me to pass new client data to Zapier in order to update our Marketing automation software.
      This is the code I have been testing now:
      add_hook('ClientAdd', 1, function ($vars) { $userid = $vars['userid']; $firstname = $vars['firstname']; $lastname = $vars['lastname']; $email = $vars['email']; $phone = $vars['phonenumber']; $city = $vars['city']; $country = $vars['country']; $postcode = $vars['postcode']; $company = $vars['companyname']; $state = $vars['state']; $params = '?userid='.$userid.'&firstname='.$firstname.'&lastname='.$lastname.'&email='.$email.'&phonenumber='.$phone.'&city='.$city.'&country='.$country.'&postcode='.$postcode.'&companyname='.$company.'&state='.$state.'&source=WHMCS'; $url = 'https://hooks.zapier.com/hooks/catch/zzz/rrrr/'.$params; $options = array( 'CURLOPT_POST' => 0 ); $response = curlCall($url,$postfields,$options); logActivity('logged addClient with params: ' . $params . 'following is the result: ' . $request, $userid); }); I also tried to send this via file_get_contents but it does not seem to work, by composing the url together with real world values gotten from the LOG in the admin area the request works on Zapier's end, I suppose that the problem lies within WHMCS and the request. The Zapier request has been altered for privacy reasons.
       
      Can anyone point me in the right direction?
    • By Eldremor
      Hello again!
      The title says everything. I found a hook on github but it's not working so I'm here to ask for help 😊
      I hope this topic help a lot of people.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated