[wp-hackers] Auto Add Page on Theme Select
Joost de Valk
joost at yoast.com
Tue Jun 9 18:40:16 GMT 2009
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/
More information about the wp-hackers
mailing list