[wp-hackers] Auto Add Page on Theme Select
glenn at glennansley.com
Tue Jun 9 19:08:08 GMT 2009
In the meantime, it may help to parse the GET arguments for
action=activate and template=[yourtemplate].
Hook a function to the init like Westi suggested and do your checks on
the GET string at that point.
On Tue, Jun 9, 2009 at 2:40 PM, Joost de Valk<joost at yoast.com> wrote:
> Peter Westwood wrote:
>> On 9 Jun 2009, at 19:11, Steve Bruner [SlipFire] wrote:
>>> Hi All,
>>> I'm creating a theme and would like a Page to be auto created when the
>>> is selected. Would obviously check to make sure the page doesn't
>>> pre-exist. Tried using the switch_theme hook but it seems that it won't
>>> execute in functions.php, only a plugin.
>> The switch_theme action will run when the previous theme is still
>> effectively active as during the page load the switch happens the old themes
>> functions.php is still included.
>> You best bet is to do something on the init action for now.
>> But it would be good to open a ticket in trac requesting a way for this to
>> be achieved.
>> I think we need an activation hook for the theme which runs on the first
>> page load that a theme is active for in the admin
> +1 for that, that would make a lot of stuff easier in theme settings.
> *Joost de Valk*
> SEO & Web Development (Magento & WordPress)
> OrangeValley <http://www.orangevalley.nl> & Yoast <http://yoast.com>
> E: joost at orangevalley.nl <mailto:joost at orangevalley.nl> - joost at yoast.com
> <mailto:joost at yoast.com>
> T: +31624555808 | @yoast <http://twitter.com/yoast> on Twitter
> W: http://yoast.com/
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers