Jump to content

Active template in hook


Recommended Posts

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 by WHMUp
Link to comment
Share on other sites

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.

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