I use this snippet for displaying new tab.
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'Anwendung', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>Anwendung</h2>';
echo (get_post_meta( $post->ID, "anwendung", true ));
}
And create Custom Field with "anwendung" slug.
But on frontend the Display of Field is missing.
But this snipped should work i guess?
There u see it:
hidden link
Edit:
I added this in the content function before echo … :
global $post;
Now it works. The solution is right?
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
There is no $post variable declared in your second function.
You likely need the global $post object:
function woo_new_product_tab_content()
{
// The new tab content
echo '<h2>Anwendung</h2>';
global $post;
echo (get_post_meta($post->ID, "anwendung", false));
}