Home Page › Forums › WooCommerce Custom Tabs › custom fields
- This topic has 3 replies, 2 voices, and was last updated 9 years, 7 months ago by
WebshopLogic.
-
AuthorPosts
-
Participant
Hello!
1. Can i somehow put custom field data into the tab? How would I do that?
JasonKeymasterHello Jason!
Yes, you can put custom field data into tabs the same way as into a normal post content.
For example, there is some plugin that displays custom fields using shortcodes.
E.g. Custom Content Shortcode plugin may be useful for you. (I have not tried this plugin, just read the documentation.)Best Regards,
Peter Rath
WebshopLogicParticipantI got is to work per post. How do i do this globally? I have 4,000 products and just want a shortcode put into the tab globally.
Thanks!KeymasterHi Jason!
You can not set it in the admin panel, and there is a filter, that can be used to solve it.
Please insert a little php code into your functions.php file in the directory of your active theme:
function wct_woocommerce_tab_content ($tab_content, $tab_code) { if ($tab_code == 'YOUR_TAB_CODE') { $tab_content = '[YOUR_SHORTCODE]'; $tab_content = apply_filters('the_content', $tab_content ); //process shortcodes } //$tab_content = '$tab_code: ' . $tab_code . $tab_content . chr(13); //display tab_code return $tab_content; } add_filter ('wct_woocommerce_tab_content', 'wct_woocommerce_tab_content', 10, 2);
Please substitute YOUR_TAB_CODE and YOUR_SHORTCODE expressions with your appropriate value. If you remove the remark sign (//) from the beginning of the //$tab_content…. row, then you can see the tab_codes of your actually selected tab pages. You can write this code in the if statement.
I hope you can do what you would like this way.
If you have any question, please let me know.
Best Regards,
Peter Rath
WebshopLogic -
AuthorPosts
- You must be logged in to reply to this topic.