Last active
April 8, 2020 17:06
-
-
Save mio31337/16014ff5eb5f7501f087f672de47404a to your computer and use it in GitHub Desktop.
WooCommerce: Add custom tabs
This file contains hidden or 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
/** | |
* Add custom tabs | |
* Author: MarioMarkovic.com | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'custom_product_tabs' ); | |
function custom_product_tabs( $tabs ) { | |
if(get_field('navodila_za_uporabo')) { | |
$tabs['general'] = array( | |
'title' => __('Navodila za uporabo', 'nm-framework'), | |
'callback' => 'product_tab_instructions_content', | |
'priority' => 50, | |
); | |
} | |
return $tabs; | |
} | |
/** | |
* Function that displays output for the custom tab - General. | |
* Author: MarioMarkovic.com | |
*/ | |
function product_tab_instructions_content( $slug, $tab ) { | |
// get_template_part( 'template-parts/tabs/instructions' ); | |
echo "Custom tab"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment