This post has been updated to be WooCommerce 2.0+ Product Tabs compatible.
This is a follow up post from my original post on how to add Multiple Custom Product Tabs to WordPress. I received a lot of questions on how to create/code the second tab and call both into the backend. I’ll reiterate that all of this code may not be the most elegant solution. Justin over at FoxRunSoftware mentioned in his post that someone was authoring a better solution. I hope they’ll drop an official extension soon.
However, until an official solution drops were left with the patch work. So here it goes!
How to create multiple tabs?
- Create two files in your theme directory
( I created mine in a separate folder named “inc” )
- Call each file from your functions.php file with the code below. Place the code at the top to make it easy after your php declaration. Doing this keeps each block of code separate, clean, and free from us mucking it all up later :).
require_once get_template_directory() . '/inc/custom-woospecs.php'; // woocommerce custom tabs require_once get_template_directory() . '/inc/custom-woodownloads.php'; // woocommerce custom tab 2
Cool, now give me the code for each product tab!
- Grab the code for your first tab here: http://pastebin.com/BsX3CpTZ
- Grab the code for your second tab here: http://pastebin.com/N39FFBgK
Nice, do you have a version with the the WYSIWYG Editor?
WARNING: It’s easier to call the editor than it used to be but it has bugs. Something about it being called and errors in the DOM. It works okay but don’t try moving the custom panel or it’ll corrupt your data.
- Grab the code for your WYSIWYG first tab here: http://pastebin.com/GjBKk5sz
If you enjoyed this post shoot me back a link or even better donate $10 to the
Navy SEAL Foundation. Cheers!