Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
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 '11 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

share|improve this answer
    
It definitely looks interesting, but I need a little bit more flexibility than custom post types. –  Andrew M Jun 14 '11 at 0:48
    
how do you mean "flexibility" .... custom post types are extremely flexible –  byronyasgur Jun 21 '11 at 2:25
    
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 '11 at 22:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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