ChrisTERiS Posted April 6, 2021 Share Posted April 6, 2021 (edited) Hello all, Is there any global variable that I can use in a hook code to determine the active template name? eg I need to execute a hook but only if the template is the Twenty-one. Much better if I can restrict the hook execution if the template is twenty-one or child of twenty-one Thank you Chris Edited April 6, 2021 by WHMUp 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2021 Share Posted April 6, 2021 1 hour ago, WHMUp said: Is there any global variable that I can use in a hook code to determine the active template name? eg I need to execute a hook but only if the template is the Twenty-one. $template should equal the name of the theme being used - even if it's a child. 2 hours ago, WHMUp said: Much better if I can restrict the hook execution if the template is twenty-one or child of twenty-one well if $template = "twenty-one", then it's probably safe assume that they haven't renamed Six to 21 for fun.... the problem will be determining child themes based on 21 - I can see that the parent name of the child theme is in the $theme object, but it's protected - it might be worth contacting support to see if there is a built-in method to access these values. 1 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.