| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDeveloper\BetterDocs\Shortcodes; |
| 4 |
|
| 5 |
use WPDeveloper\BetterDocs\Core\Shortcode; |
| 6 |
|
| 7 |
class PostContent extends Shortcode { |
| 8 |
protected $html_attributes = []; |
| 9 |
|
| 10 |
public function get_name() { |
| 11 |
return 'betterdocs_post_content'; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Summary of default_attributes |
| 16 |
* @return array |
| 17 |
*/ |
| 18 |
public function default_attributes() { |
| 19 |
return [ |
| 20 |
'post_id' => get_the_ID(), |
| 21 |
'htags' => 'h1,h2,h3,h4,h5,h6', |
| 22 |
'enable_toc' => '', |
| 23 |
'toc_hierarchy' => '', |
| 24 |
'list_number' => '', |
| 25 |
'display_toc_on_top' => '', |
| 26 |
'collapsible_toc_mobile' => '' |
| 27 |
]; |
| 28 |
} |
| 29 |
|
| 30 |
public function render( $atts, $content = null ) { |
| 31 |
$post = get_post( $get_args['post_id'] ); |
| 32 |
|
| 33 |
return betterdocs()->template_helper->content( |
| 34 |
$post->post_content, |
| 35 |
$this->attributes['htags'], |
| 36 |
$this->attributes['enable_toc'] |
| 37 |
); |
| 38 |
} |
| 39 |
} |
| 40 |
|