-
-
Save jasperf/5ac0de4e45bd5fe1c8852207cdb0371e to your computer and use it in GitHub Desktop.
Create custom product details tabs within WooCommerce using an ACF (Advanced Custom Fields) Repeater field.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( function_exists('acf_add_local_field_group') ): | |
acf_add_local_field_group(array ( | |
'key' => 'acf_product_options', | |
'title' => 'Product Options', | |
'fields' => array ( | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_label', | |
'label' => 'Tabbed Content', | |
'name' => '', | |
'type' => 'tab', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array ( | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
), | |
'placement' => 'top', | |
'endpoint' => 0, | |
), | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_tabs', | |
'label' => 'Tabs', | |
'name' => 'tabs', | |
'type' => 'repeater', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array ( | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
), | |
'min' => '', | |
'max' => '', | |
'layout' => 'row', | |
'button_label' => 'Add Tab', | |
'sub_fields' => array ( | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_tab_title', | |
'label' => 'Tab Title', | |
'name' => 'tab_title', | |
'type' => 'text', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array ( | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
), | |
'default_value' => '', | |
'placeholder' => '', | |
'prepend' => '', | |
'append' => '', | |
'maxlength' => '', | |
'readonly' => 0, | |
'disabled' => 0, | |
), | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_tab_content', | |
'label' => 'Tab Content', | |
'name' => 'tab_content', | |
'type' => 'wysiwyg', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => array ( | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
), | |
'default_value' => '', | |
'tabs' => 'all', | |
'toolbar' => 'full', | |
'media_upload' => 1, | |
), | |
), | |
), | |
), | |
'location' => array ( | |
array ( | |
array ( | |
'param' => 'post_type', | |
'operator' => '==', | |
'value' => 'product', | |
), | |
), | |
), | |
'menu_order' => 0, | |
'position' => 'normal', | |
'style' => 'default', | |
'label_placement' => 'top', | |
'instruction_placement' => 'label', | |
'hide_on_screen' => '', | |
)); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment