php - WooCommerce product - Displaying post_content value of product object -
when use:
print_r($product);
it returns following:
wc_product_simple object ( [id] => 156 [post] => wp_post object ( [id] => 156 [post_author] => 1 [post_date] => 2016-07-01 08:59:05 [post_date_gmt] => 2016-07-01 06:59:05 [post_content] => single product picture .....
how echo out value [post_content]
?
i using wordpress woocommerce plugin.
thanks.
as can see $product
object contains post
object (and not arrays). try 1 of this:
$product_content = $product->post->post_content; echo $product_content; // or directly // echo $product->post->post_content;
or 1 should work too:
$_product = $product->post; echo $_product->post_content;
Comments
Post a Comment