Home › Forums › Gutenberg › Can't output values on frontend › Reply To: Can't output values on frontend
Hi
I am attempting a very similar thing to you but having the same problem. When I add a block, type some content into the editor, then deselect the block, and reselect it, the values I entered are missing.
I have stripped it all back to a really simple test in my functions.php file as follows:
acf_register_block(array(
'name' => 'my_test',
'title' => __('Test'),
'description' => __('A Test'),
'render_callback' => 'render_test',
));
function render_test() {
$title = get_field('title');
$content = get_field('content');
?>
<h2><?php echo $title ?></h2>
<?php echo $content ?>
<?php
}
My template is simply:
<?php get_header(); ?>
<?php the_content() ?>
<?php get_footer(); ?>
I am using 5.8-beta3. I am at a bit of a loss as to what is going on. If anyone could give me any suggestions, I would really appreciate it!!
Many thanks
David
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.