lazy-blocks icon indicating copy to clipboard operation
lazy-blocks copied to clipboard

Get post data in admin

Open sandromattei opened this issue 4 years ago • 1 comments

Hi,

I need to create a block that shows the title of the post. How can I insert the post title in the block attributes? Thank you

sandromattei avatar Mar 08 '20 15:03 sandromattei

Hi, this code works for me:

<?php global $wp_query; ?>

<h1 class="title"><?php echo get_the_title($wp_query->posts[0]->ID) ?></h1>

serhumanos avatar Jul 25 '21 22:07 serhumanos