I have a WordPress issue that has been keeping me busy for a few days.
I’m currently building a website for a client.
This website will show products and each product page also has a table with specifications of the product.
The specifications will be shown in a table like this:
What would be the best way to implement this in the template, so the client can add data for each product from the back-end?
Each product gets its own page of course.
For example:
iPhone 4S
iPhone 5
etc. (no it’s not an Apple-related website, just an example)
You could easily do that with Product Specifications plugin.
This plugin is built for this purpose and you won’t need any additional code, However it comes with a
[specs-table]
shortcode that you can use elsewhere.The plugin automatically adds a tab called “product specifications” to woocommerce single product page and shows product spec. table,
Read more at plugin’s page on wordpress.org
You could do this by adding Meta Boxes to your custom post type. Here’s two URLs that explain it, it’s pretty easy:
http://codex.wordpress.org/Function_Reference/add_meta_box
http://wp.tutsplus.com/tutorials/integrating-with-wordpress-ui-meta-boxes-on-custom-pages/
The Meta Box just works like another field to edit on the Post edit screen so integrates really well. You should be able to layout a grid like you specified above.
You can use update_post_meta() to save your values to the database so no extra DB tables or fields are required.
Steve’s answer above is the best way of doing it, of course, but if the client isn’t too afraid of technology, she could also just add the required data via the standard custom field interface. Not quite as user-friendly, though.
There’s also the Advanced Custom Fields plugin, if you don’t fancy rolling your own metaboxes.