Does Wordpress have the ability to use the currently defined template to serve up content in the database?

For example, I have a database of a bunch of custom content-- the name of an item, the price, etc.

I want all requests for http://myshop.com/buy/* to be redirected to the plugin (so that the plugin handles the content generation), where the * is an item number or some other parameter. Can I use the Wordpress template and display my custom content? I would be handling all of the HTML generation for inserting into the template...

The best example I can find is the WP Ecommerce plugin here: http://getshopped.org/. Basically, the plugin is handling the checkout page (/checkout in most cases, /icons/checkout on IconDock). How can I do this?

2 Answers 2


There are two different things happening here. I'll start with your second example, as that's easier.

Most shopping carts, in your example WP-Ecommerce, create placeholder pages with a shortcode for things like the cart page and checkout page. All they're doing to handle that is creating a shortcode function and inserting it on a page, then outputting whatever they need to in the shortcode function. In this case the shortcode is static, and there isn't any other data being passed via the url. The actual product pages in WP-Ecommerce are just a WordPress custom post type with some extra meta data.

What you're talking about, creating your own url structure via a plugin to pass data, involves writing your own rewrite rules via the WP_Rewrite class and inserting your own query vars.

  • Interesting-- I didn't realize that they just created short tags. In my case, I might actually go for the WP-Rewrite route. This will be proprietary and only be installed on my server for a single website, so I don't really need to handle multiple server configurations or anything.
    – Andrew M
    Jun 14, 2011 at 0:49

in short ... wordpress can be made to do just about anything ...not 100% sure but it sounds like you're looking for custom post types - check out this video http://vimeo.com/10187055 - ( it's actually a plugin that builds the custom post types for you but you can build them yourself with the code - you will probably need to do this but the plugin in the video allows you to play with them so you can see the capabilities - not too difficult just google "custom post type" and also wordpresss taxonomy )

btw the wordpress irc on freenode can be helpful for this type of thing

  • It definitely looks interesting, but I need a little bit more flexibility than custom post types.
    – Andrew M
    Jun 14, 2011 at 0:48
  • how do you mean "flexibility" .... custom post types are extremely flexible Jun 21, 2011 at 2:25
  • 1
    As in, I need to generate custom pages. For example: example.com/compare/movie1--and--movie2. I could use the rewrite rule to capture the /movie1--and--movie2, and then show a comparison page for movie1 and 2. Movie1 and Movie2 could be anything, or it could even be 1--and--2--and--3. I don't want to create posts for every possible combo.
    – Andrew M
    Jun 23, 2011 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.