| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Shortcode; |
| 4 |
|
| 5 |
use StoreEngine\Utils\Helper; |
| 6 |
|
| 7 |
class SingleProductComments { |
| 8 |
|
| 9 |
public function __construct() { |
| 10 |
add_shortcode( 'storeengine_single_product_comments', [ $this, 'render' ] ); |
| 11 |
} |
| 12 |
|
| 13 |
public function render() { |
| 14 |
$enable_product_comments = (bool) Helper::get_settings( 'enable_product_comments', false ); |
| 15 |
|
| 16 |
if ( ! $enable_product_comments ) { |
| 17 |
return ''; |
| 18 |
} |
| 19 |
|
| 20 |
ob_start(); |
| 21 |
if ( comments_open() || get_comments_number() ) { |
| 22 |
comments_template(); |
| 23 |
} |
| 24 |
|
| 25 |
return ob_get_clean(); |
| 26 |
} |
| 27 |
|
| 28 |
} |
| 29 |
|