Skip to content

Instantly share code, notes, and snippets.

@mio31337
Last active April 8, 2020 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mio31337/16014ff5eb5f7501f087f672de47404a to your computer and use it in GitHub Desktop.
Save mio31337/16014ff5eb5f7501f087f672de47404a to your computer and use it in GitHub Desktop.
WooCommerce: Add custom tabs
/**
* 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