Check we have a product #4487

This commit is contained in:
Mike Jolley 2014-01-13 11:39:54 +00:00
parent dc880c7af7
commit ac24fe52fa
1 changed files with 6 additions and 3 deletions

View File

@ -960,28 +960,31 @@ if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) {
global $product, $post;
// Description tab - shows product content
if ( $post->post_content )
if ( $post->post_content ) {
$tabs['description'] = array(
'title' => __( 'Description', 'woocommerce' ),
'priority' => 10,
'callback' => 'woocommerce_product_description_tab'
);
}
// Additional information tab - shows attributes
if ( $product->has_attributes() || ( $product->enable_dimensions_display() && ( $product->has_dimensions() || $product->has_weight() ) ) )
if ( $product && ( $product->has_attributes() || ( $product->enable_dimensions_display() && ( $product->has_dimensions() || $product->has_weight() ) ) ) ) {
$tabs['additional_information'] = array(
'title' => __( 'Additional Information', 'woocommerce' ),
'priority' => 20,
'callback' => 'woocommerce_product_additional_information_tab'
);
}
// Reviews tab - shows comments
if ( comments_open() )
if ( comments_open() ) {
$tabs['reviews'] = array(
'title' => sprintf( __( 'Reviews (%d)', 'woocommerce' ), get_comments_number( $post->ID ) ),
'priority' => 30,
'callback' => 'comments_template'
);
}
return $tabs;
}