| @@ -1,0 +1,18 @@ | ||
| 1 | +<?php | |
| 2 | +namespace ABlocksThemeBuilder\Traits; | |
| 3 | + | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 8 | +trait RenderContent { | |
| 9 | + public function get_rendered_block_content_by_id( $post_id ) { | |
| 10 | + $post = get_post( $post_id ); | |
| 11 | + | |
| 12 | + if ( $post && $post->post_status === 'publish' ) { | |
| 13 | + return apply_filters( 'the_content', $post->post_content ); | |
| 14 | + } | |
| 15 | + | |
| 16 | + return ''; | |
| 17 | + } | |
| 18 | +} | |