[wp-hackers] best way for custom rewrites in a theme

chris chris at lod.com
Sat Jan 26 22:27:07 UTC 2013


Reason I was doing this, is its only for the theme being created, I have no
problem creating the small plugin to do it.  Client wanted it all in the
theme, I can create the plugin to be installed.


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Erick Hitter
Sent: January 26, 2013 4:49 PM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] best way for custom rewrites in a theme

Are the rewrite rules specific to functionality or templating essential, and
specific, to the theme? In that case, the rules truly belong within the
theme. In that case, the init action is appropriate for adding the rules,
query variables, and such. It's silly to force a user to install a theme,
and then a plugin, for the theme to function as advertised.

If, on the other hand, the rules are useful without the theme being active,
they should exist in a plugin.


Erick
--
Erick Hitter
erick at ethitter.com
(617) 454-4153


On Sat, Jan 26, 2013 at 2:36 PM, William Satterwhite <
whsatterwhite at gmail.com> wrote:

> s/registration_activation_hook/register_activation_hook/g
>
> On Sat, Jan 26, 2013 at 4:35 PM, William Satterwhite < 
> whsatterwhite at gmail.com> wrote:
>
> > Agreed with Justin 100%. Whatever code you add to a functions.php 
> > file in a theme for custom rewrites should exist as a plugin. It's 
> > as simple as creating a new file, dropping in your code, and making 
> > sure the header in your file follows the WordPress plugin standard. 
> > Then you can take advantage of the registration_activation_hook with 
> > out trying to use some alternate hook.
> >
> > Not only that, but if you're adding custom rewrites/routing to your 
> > website, wouldn't you want it to be theme independent? Maybe you 
> > want to run a seasonal theme or create a new theme all together, so 
> > why create
> more
> > work/restrictions by building that part in to the theme's 
> > functions.php file?
> >
> >
> > On Sat, Jan 26, 2013 at 4:31 PM, Justin Tadlock <
> justin at justintadlock.com>wrote:
> >
> >> Why would a theme be touching rewrite rules?  Whatever it is, I'm 
> >> guessing it's best to put that functionality in a plugin.
> >>
> >>
> >> On 1/26/2013 1:48 PM, chris wrote:
> >>
> >>> Usally I use register_activation_hook for flush, what hook is the 
> >>> best
> to
> >>> use for a theme?
> >>>
> >>>
> >>>
> >>> ______________________________**_________________
> >>> wp-hackers mailing list
> >>> wp-hackers at lists.automattic.**com 
> >>> <wp-hackers at lists.automattic.com> 
> >>> http://lists.automattic.com/**mailman/listinfo/wp-hackers<
> http://lists.automattic.com/mailman/listinfo/wp-hackers>
> >>>
> >>>
> >> ______________________________**_________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com> 
> >> http://lists.automattic.com/**mailman/listinfo/wp-hackers<
> http://lists.automattic.com/mailman/listinfo/wp-hackers>
> >>
> >
> >
> >
> > --
> > Hunter Satterwhite
> > http://linkedin.com/in/hsatterwhite
> > (252) 762-5177
> >
>
>
>
> --
> Hunter Satterwhite
> http://linkedin.com/in/hsatterwhite
> (252) 762-5177
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
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