I am planning to use wordpress as the base for my next web application. Earlier I have used RoR, Laravel etc. for web application and wordpress mainly for blogging.

The web application will define a seperate PRODUCT table (other than the default wordpress tables), and based on the url structure the data for a a particular product will be fetched.

e.g. http://webapp.com/product/dummy http://webapp.com/product/pummy

dummy, pummy is the seo friendly name of the specific product. Under a particular url the data for the product is to shown. The legacy data (about 15000 products) will be imported into the product table.

Most of the frameworks like RoR, Laravel etc support routing, where in you can read the url and fetch the data from the database and display. So using a function in your controller you can fetch the data and display it using views.

I want to understand the best practices and how this can be implemented in wordpress. In case product is a custom post, do we create one post per product (15000 posts in this case) etc.

  • 1
    I would strongly recommend against a dedicated products table. Custom post types are enough, and give you all the benefits of UI/caching/APIs/query helpers etc for free – Tom J Nowell Feb 28 '13 at 12:01

You can implement it in wordpress by creating custom post types

and creating one post per product.

In your above stated example :


Custom Post Type will be product and pummy will be slug of custom post. You can use above url structure by changing wordpress Permalink Settings to Post name.

You can handle this product page by creating single-product.php file in your theme. for more information about this file , see this page.

In this file just call built in functions of wordpress to display data of that particular product and wordpress will manage querying database and retrieving data for you.

Example functions : the_title(); the_content(); the_excerpt();

  • Hi Vinod, this is what I also thought. However I feel there should be a more elegant way. Creating 15000 custom posts by hand or through program, and mantaining them, doing seo etc is a bit cumbersome. Whats your opinion? – Deepak Kundu Feb 28 '13 at 11:37
  • We must enter individual product data in database. we can enter it by custom post types , entering it in excel or csv file then importing it or by any other way. E commerce softwares also implement these techniques. Which type of functionality do you want to implement? Is it different from this? – Vinod Dalvi Feb 28 '13 at 11:46
  • Entering 15000 table entries by hand is also cumbersome and could take months. There's nothing stopping you entering it into an intermediate format that's easy for you to add items to, and easy for an automated script to read – Tom J Nowell Feb 28 '13 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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