homegrade_blocks_production/blocks/post-content-container/build/render.php
2024-07-01 15:48:00 +02:00

11 lines
484 B
PHP

<?php
$relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId);
$anchor = isset($attributes['anchor']) ? esc_html($attributes['anchor']) : "post-content-container-" . $relatedPostId;
?>
<section id="<?php echo $anchor ?>" class="post-content-container <?php echo $anchor ? "has-custom-anchor" : "" ?>">
<h2 class="post-content-container__title"><?php echo $relatedPost->post_title ?></h2>
<?php echo $relatedPost->post_content ?>
</section>