[wp-hackers] The problem with WP_Rewrite <<< RE: Options for Controller - Views

Otto otto at ottodestruct.com
Thu Dec 3 17:43:30 UTC 2009


On Thu, Dec 3, 2009 at 11:29 AM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> Maybe you should drive down from Tennessee to Atlanta to the WordPress users group and/or the Atlanta Bloggers group and ask for a show of hands for how many people understand and can use regular expressions?  My guess is you *might* get 2 in 100 to raise their hands.
>
> See I think you are so advanced it's difficult for you to understand just how hard some of this stuff is for most users (the irony? Most people around here know me as the "advanced" guy. :-)

... To be quite blunt, if a person is not capable of understanding
regular expressions, and can't look in a book for 10 minutes to figure
out what they want to do, then they should not be writing code of any
kind. They should stick to something simple, like flipping burgers.

Obviously, I don't expect an end user to understand regular
expressions. I wouldn't want people making fields to put regexp on the
admin screens, for example.

But there's a certain level of knowledge you need to obtain to write
code, and to write PHP code in particular. Simple Regular Expressions
is one of those most basic levels of things you need to know, just
after string handling.

Do I expect a plugin author to understand regexp? Absolutely.
Do I expect a theme author to understand regexp? No.
Do I expect them to be able to ask somebody or Google search to find
examples? Yes.

>> The post_type variable is supported in 2.8, but *custom* post_type
>> support wasn't added until 2.9.
>
> But it still doesn't work in 2.8, right?   At least it didn't work when I tried to use the URL with a post_type parameter on an existing live site.  Anyway, not important.

No, it works in 2.8 just fine, but the post_type must be "post", or
"page", or "attachment", etc. Basically, wp_query didn't like anything
but the various built in ones.

> Conversely I'm floored by your adamancy about not wanting to make this common need approachable.  The code you mention is fine for plugins but not fine for themes.

The code I mentioned was *far* more appropriate for themes than for
plugins, because it's creating specific conditions that the theme must
satisfy (like having a custom/products.php file in it, for example).
And it didn't even require regexp.

> The skill level for PHP coding among plugin developers is much higher than for your *average* themer who in many cases use cuts and pastes PHP code from examples...

What's wrong with them cut and pasting the example from somewhere and
modifying it to their needs?

More to the point, what makes you think a theme author isn't going to
do the same with your add_custom_url nonsense, eh? You've got a ton of
"magic" words in there... url-type, callback, single-post, etc, etc.
And it's using an array as well.

I am really not seeing why you think your method is any easier or less
complicated, especially if you're going to assume that the theme
author doesn't know PHP all that well. Heck man, theme authors cut and
paste the register_sidebar calls for their functions.php files all the
time, and they're about as complex as your add_custom_url is.

-Otto
Sent from Memphis, TN, United States


More information about the wp-hackers mailing list