#10160 closed enhancement (duplicate)
Load template/stylesheet defines after locale
Reported by: |
|
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)
#2
@
14 years ago
- Summary changed from Load template/stylesheet functions later after init to Load template/stylesheet defines after locale
#3
@
14 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.
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.