[wp-hackers] Auto Add Page on Theme Select

Glenn Ansley 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.

Glenn Ansley
http://fullthrottledevelopment.com
http://twitter.com/full_throttle
http://twitter.com/glennansley

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
>>> theme
>>> 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
>>
>> westi
>
> +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
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list