• andwat

    (@andwat)


    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(’stylesheet_directory’). 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Root

    (@root)

    Its a bloginfo parameter already surely?

    Codex updated. There is not currently a constant defined for it, but you can get the theme/stylesheet path with get_stylesheet_directory().

    Yes, you can use bloginfo(‘stylesheet_directory’) too.

    Root

    (@root)

    And there is a template path as well.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘templatepath’ is closed to new replies.