[wp-hackers] Showing custom page types
Chris Jean
gaarai at gaarai.com
Thu Jan 29 21:41:19 GMT 2009
Wow... "better known on the list". I'm hanging that on the wall.
I recently posted on my blog about using WordPress as a web application
framework, and it got me thinking about really breaking out of the box
of blogging and creating a application site completely based on
WordPress. I've been wanting to build a DNS tool site for a few months
now, so it was easy to figure out what to tackle.
This project quickly got me shaking my head on how the devs intend for
plugin developers to add code-generated page output. The reasonable
answer seems to be that they don't or haven't gotten around to adding
such functionality.
There are many different functions that add rewrite rules, tags, and
what-have-you, yet most of those functions aren't used in the core at
all and the documentation provided is extremely terse. Core seems to
just hard code all the pertinent data directly into the data structures,
so I have no idea how the dev team would use these functions or if they
are of value at all to what I want to do.
You're right on the money when you say that the template-loader doesn't
offer any latch points for a plugin developer to use directly. I looked
in that file and quickly realized that any solution that didn't require
the theme files would have to be a hack job and would be very prone to
breaking. This explains my exotic notions of using the do_robots action
or latching into the single process.
I like your URL template idea. I see that /companies/{company}/ template
as not only setting up the add_rule regex but also registering a query
var called 'company'. After seeing this, I'm definitely going to play
around with creating my own URL templating system to make doing all the
add_rule and add_query_var calls simpler.
I'll send you a personal email in a moment to give you more details.
Chris Jean
http://gaarai.com/
http://wp-roadmap.com/
http://dnsyogi.com/
Mike Schinkel wrote:
> Chris:
>
> I have exactly the same needs. URL management and related content is a real pain in WP (unlike Drupal which is easy and from whence I came.) I've been meaning to write about it but am glad someone else better known on the list has decided to tackle the issue first.
>
> I've identified that /wp-content/template-loader.php doesn't provide any reasonable way to let someone call custom code off a custom URL.
>
> I'd love to work with you on this. It's probably what I see as WordPress' biggest limitation for my own needs followed closely by lack of custom post types.
>
> -Mike Schinkel
> http://mikeschinkel.com/
>
> P.S. I've also come to the conclusion that requiring the use of regex for URL mapping greatly reduces the number of people who can approach using WordPress as a CMS. I'd really like to see URL Templates used as for the 80% cases and then regex could be used for the more advanced cases. For example, if I wanted to create a list of companies, I'd like to be able to specify the URLs like this:
>
> /companies/
> /companies/{company}/
> /companies/{company}/overview/
> /companies/{company}/details/
>
> I've done some work in that area at http://code.google.com/p/simpleurlmapper/
More information about the wp-hackers
mailing list