Created
November 28, 2019 14:35
-
-
Save boospot/206a4b2289ca9a4b2610772e3db9afa8 to your computer and use it in GitHub Desktop.
test mb-woocommerce
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
// Register a theme options page | |
add_filter( 'mb_woocommerce_tabs', function ( $woocommerce_tabs ) { | |
$woocommerce_tabs[] = array( | |
'id' => 'giftcard', | |
'label' => __( 'Gift Carding', 'woocommerce' ), | |
'target' => 'giftcard_options', | |
'class' => array( 'show_if_simple', 'show_if_variable' ), | |
); | |
$woocommerce_tabs[] = array( | |
'id' => 'license', | |
'label' => __( 'License', 'woocommerce' ), | |
'target' => 'license_options', | |
'class' => array( 'show_if_simple', 'show_if_variable' ), | |
); | |
return $woocommerce_tabs; | |
} ); | |
// Register meta boxes and fields for settings page | |
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { | |
$meta_boxes[] = array( | |
'id' => 'general', | |
'title' => 'General', | |
'woocommerce_tabs' => 'giftcard', | |
'fields' => array( | |
array( | |
'name' => 'Logo', | |
'id' => 'logo', | |
'type' => 'file_input', | |
), | |
array( | |
'name' => 'Layout', | |
'id' => 'layout', | |
'type' => 'image_select', | |
'options' => array( | |
'sidebar-left' => 'https://i.imgur.com/Y2sxQ2R.png', | |
'sidebar-right' => 'https://i.imgur.com/h7ONxhz.png', | |
'no-sidebar' => 'https://i.imgur.com/m7oQKvk.png', | |
), | |
), | |
), | |
); | |
$meta_boxes[] = array( | |
'id' => 'colors', | |
'title' => 'Colors', | |
'woocommerce_tabs' => 'pencil', | |
'tab' => 'design', | |
'fields' => array( | |
array( | |
'name' => 'Heading Color', | |
'id' => 'heading-color', | |
'type' => 'color', | |
), | |
array( | |
'name' => 'Text Color', | |
'id' => 'text-color', | |
'type' => 'color', | |
), | |
), | |
); | |
$meta_boxes[] = array( | |
'id' => 'info', | |
'title' => 'Theme Info', | |
'woocommerce_tabs' => 'pencil', | |
'tab' => 'faq', | |
'fields' => array( | |
array( | |
'type' => 'custom_html', | |
'std' => 'Having questions? Check out our documentation', | |
), | |
), | |
); | |
return $meta_boxes; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment