ThemeMetro Posted June 4, 2017 Share Posted June 4, 2017 (edited) Hello, I want to run a hook only one template? I mean the primary navigation bar hook should be run if anyone access the WHMCS by using index.php?systpl=six Not on any other template. Edited June 5, 2017 by ThemeMetro 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2017 Share Posted June 5, 2017 I want to run a hook only one template? I mean the primary navigation bar hook should be run if anyone access the WHMCS by using index.php?systpl=six Not on any other template. I might be tempted to try something like this... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { GLOBAL $smarty; $template = $smarty->getVariable('template'); if ($template == 'six' && !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home') ->setLabel('Brian'); } }); in the above example if using the six template, the home link will be renamed to "Brian"... if using any other template, it will do nothing.... though bear in mind this would fail if they've renamed the "six" folder to something else. 1 Quote Link to comment Share on other sites More sharing options...
ThemeMetro Posted June 6, 2017 Author Share Posted June 6, 2017 Thank you very much I might be tempted to try something like this... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { GLOBAL $smarty; $template = $smarty->getVariable('template'); if ($template == 'six' && !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home') ->setLabel('Brian'); } }); in the above example if using the six template, the home link will be renamed to "Brian"... if using any other template, it will do nothing.... though bear in mind this would fail if they've renamed the "six" folder to something else. 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.