Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to make template for similar (product) posts? (Plugin maybe?) WordPress

I'm making a WP site which makes use of the blogging functionality in two ways: as well as a standard blog there will be lots of posts about particular products which will all carry the same kind of information (e.g. name, size, type, description, picture).

I'd like to make some kind of template for these so that they look consistent and also to avoid creating the styling every time a new product is added.

Also, I intend to hand over the updating of this site to my client once the website is ready, and it would be great if she could update something really simple every time she adds a new product (a form perhaps?)

I wonder if anyone can recommend a plug-in for this kind of thing? Or help me create something workable?

I'm pretty new to WordPress (but keen!)

A couple of things, in case they're relevant:

- There's no e-commerce functionality, this is a showcase of products, not a shop.

- My client is a not-for-profit and I'm doing this for free!

I'd be grateful for some help with this.

Answers (1)

2011-09-08

John Cotton answers:

Use a [[LINK href="http://codex.wordpress.org/Post_Types"]]custom post type[[/LINK]].

Make the post title the name, the post content the description. Use the featured image field to store the product photo.

Then use the [[LINK href="http://codex.wordpress.org/Function_Reference/add_meta_box"]]add_meta_box[[/LINK]] function to create a nicely laid out form for price, type and whatever else you need. These can all be saved using [[LINK href="http://codex.wordpress.org/Function_Reference/update_post_meta"]]update_post_meta[[/LINK]].

(You could just leave your client to use the custom fields that come by default, but a special meta box looks more professional and gives you more certainly over what will end up where in the database.)

Create an archive-YOUR_CUSTOM_TYPE.php file in your theme to handle display of lists of the products. There are some settings when you create the custom type that determine the slug for this file eg http://www.whatever.com/our-products so you can be creative.

Then you can create a single-YOUR_CUSTOM_TYPE.php file that you can use to output all this data as you wish!

JC


Rebecca Brueton comments:

Thanks for the reply. I'm not sure I understand all of it, but I'm going to have a go!


John Cotton comments:

Have a read of the pages I've linked to and then ask on anything that isn't clear.

Follow my list and go with the grain of how WordPress works (it really is the best CMS on the planet) - you'll find it all works out neatly :)


Rebecca Brueton comments:

Thanks :)

I'll disappear for a while now, but I'll be back!