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

Erick Hitter erick at ethitter.com
Sat Jan 26 21:48:47 UTC 2013


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
>


More information about the wp-hackers mailing list