Jump to content

Need to create an hook for a specific theme


Maver87

Recommended Posts

Hi people,

i need to use an hook to modify  some menu items in client area and in particularly in PrimaryNavbar and Sidebar menu, the problem  i have is to make work  this hook with only specific theme, below part of hook that could be generally but not specific for a custom theme.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar',1, function (MenuItem $primaryNavbar)

{

if (!is_null($primaryNavbar ->removeChild('Open Ticket'))){

}

});

 

Thank you for your suggestions.

Regards

 

Link to comment
Share on other sites

23 hours ago, Maver87 said:

i need to use an hook to modify  some menu items in client area and in particularly in PrimaryNavbar and Sidebar menu, the problem  i have is to make work  this hook with only specific theme, below part of hook that could be generally but not specific for a custom theme.

if you are wanting to  *only* remove items from the navbar/sidebars, then using css might be a simpler option.

#Primary_Navbar-Open_Ticket {display: none;}

that way you could add your specific css code to that theme's custom.css file and these changes will only apply to that particular theme.

if you need to do more than just remove existing items, then a hook would become necessary -  in hooks, it is entirely possible for changes only to apply to specific themes / templates or pages.

Link to comment
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.

  • 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