Discussion:
running a filter on stylesheet and template
Chris McCoy
2013-07-02 13:32:23 UTC
Permalink
im running a filter on stylesheet and template to serve up a mobile theme,
if i put the code in a plugin it works fine, but when its in a theme it
doesnt seem to be running the filter.

would the theme code be running too late?
John Blackbourn
2013-07-02 13:41:31 UTC
Permalink
Post by Chris McCoy
im running a filter on stylesheet and template to serve up a mobile theme,
if i put the code in a plugin it works fine, but when its in a theme it
doesnt seem to be running the filter.
would the theme code be running too late?
You're running a filter in your theme to filter your theme? ;-)

Yes, these filters needs to be used by a plugin.

John
Andrew Nacin
2013-07-02 13:42:48 UTC
Permalink
Post by Chris McCoy
im running a filter on stylesheet and template to serve up a mobile theme,
if i put the code in a plugin it works fine, but when its in a theme it
doesnt seem to be running the filter.
If you try to have a different theme loaded after the theme has already
loaded, well, you're gonna have a bad time. You could either do this in
a plugin or use the template_include filter, or a host of other ways
depending on the desired effect.

Loading...