Support » Plugins » How to get the folder with the theme?

  • Resolved hategrinder


    Hello! I’m writing a plugin that is going to modify template files when switching to it, so I need to know, in which folder template files are. I tried to use switch_theme action , but it gives only the name of the theme, whilst the folder can named the other way. For example if the theme name, given by action, is ‘The Theme’, folder can be ‘the_theme’, ‘thetheme’, ‘the-theme’, ‘the-theme-10’, ‘TheTheme’ … Is there any way to get the folder, template is in? TIA

Viewing 2 replies - 1 through 2 (of 2 total)
  • The constant TEMPLATEPATH is a reference to the absolute path to the template directory for the current Theme (without the / at the end).

    You can also use get_template_directory(), but the constant is simpler.

    Otto42, thanks! Hovewer in this case TEMPLATEPATH won’t work, probably because this constant is redefined after the theme is changed and switch_theme is executed before, so it returns the path to current template, but get_template_directory() returns the new path to template and that’s cool:) Thanks once again)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get the folder with the theme?’ is closed to new replies.