WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#6718 closed defect (bug) (invalid)

Theme defined in a constant at the beginning of the script

Reported by: kazdam Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

In every version of wordpress, the theme path is defined in a constant, which is defined at the all beginning of the script.

This is disallowing plugins developers to modify the theme used in an extension if some others datas are requires (like the post id) are required to get the current theme.

It might be a good idea to define it later, at least after defining the $post var.

Change History (4)

comment:1 follow-up: Viper007Bond6 years ago

Pretty sure there are hooks and all that stuff that exist to allow you to do this.

Take the theme switcher plugin for example -- it can change the theme being displayed to a particular user.

comment:2 Viper007Bond6 years ago

  • Component changed from Optimization to General

comment:3 in reply to: ↑ 1 kazdam6 years ago

Doesn't agree. The Theme Switcher Plugin is changing the theme based on the user cookies. It doesn't require any informations about the page we're on and the post informations.

The theme folder is based on a constant defined at the very beginning, even before we know in what kind of page we are.
The only possibility to change it would be to get the post informations in the theme and so we should define the template as we want.

But that would be completely insane. Plugins should not need to redefine every information provided after by the script as they're supposed only to use those informations ...

comment:4 jacobsantos6 years ago

  • Keywords plugin development theme constant path removed
  • Milestone 2.7 deleted
  • Resolution set to invalid
  • Status changed from new to closed

The theme path is set in functions now with filters for modifying the directory. The template path is really for the directory of where the themes are located and not exactly where the current theme is used.

Note: See TracTickets for help on using tickets.