templatepath
-
The codex states that: “The constant TEMPLATEPATH is a reference to the absolute path to the current theme directory.”
I don’t think that the codex is correct here. I think that TEMPLATEPATH points to the current template directory. This will differ from the theme directory if the theme in question specifies a parent theme. For example, one of my themes, TheGatesWay, includes in its header the line:
Template:winterway
So winterway is the parent theme, and the template (i.e. the .php files) is inherited from it.TEMPLATEPATH correctly refers to the directory winterway. It does not refer to the directory in which TheGatesWay’s style.css lives, and nor should it.
It would be nice if there was another constant, THEMEPATH, that did refer to the current theme directory. Yes, one can get to this using bloginfo(a€?stylesheet_directorya€?). But a predefined constant for the theme, similar to the one for the template, would be neat and symmetrical.
To summarize: I’ve pointed to what I think is a minor error in the codex; and I’ve requested that future versions of WP include a new constant. To conclude: sorry to have been so long-winded about this.
- The topic ‘templatepath’ is closed to new replies.