Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#10160 closed enhancement (duplicate)

Load template/stylesheet defines after locale

Reported by: casualgenius's profile casualgenius Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords: 2nd-opinion
Focuses: Cc:

Description

I write a plugin that lets site owners have different categories served up as subdomains. One of the main features is you can pick different themes for the different subdomain categories. This all worked fairly well until wordpress 2.8 was released.

My plugin uses get_categories to find a list of all categories. In 2.8 you moved the creation of default taxonomies into a function (create_initial_taxonomies) that is run by the "init" action hook. However my plugin needs to use the get_categories function before init.

I know it's been said that plugins shouldn't actually do anything before init (as mentioned here #9647). However, the Template and Stylesheet functions are loaded before init. Therefore I have to do something with the categories prior to init because I need to have filters for "pre_option_template" and "pre_option_stylesheet" ready to supply the new template/stylesheet path should it need to.

I know I could just write some custom SQL to get the data I need and discard get_categories. I've already had to do this for fetching the list of authors on the site (plugin supports subdomain by author too). But really I'd rather use the available wordpress API.

I'm sorry if this has been a very long winded way of reaching my question, which is:

Can the define of the TEMPLATEPATH and STYLESHEETPATH and subsequent loading of theme functions (should they exist) be done after init rather than before?

Change History (6)

#1 @Denis-de-Bernardy
15 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Unassigned to 2.9

the reasoning was to allow the localization of taxonomy related stuff.

maybe we could add an action, e.g. locale_loaded, dump the taxonomy registrations in there, and define the template and stylesheet constants afterwards.

#2 @Denis-de-Bernardy
15 years ago

  • Summary changed from Load template/stylesheet functions later after init to Load template/stylesheet defines after locale

#3 @Denis-de-Bernardy
15 years ago

not entirely sure what the impact of this would be though. it might be that the load_theme_textdomain call, or whatever its name is, might need to be done before the WP_Locale object is created.

#5 @Denis-de-Bernardy
15 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

closing this in favor of the latter ticket.

#6 @Denis-de-Bernardy
15 years ago

fixed (see the other ticket)

Note: See TracTickets for help on using tickets.