Support

Account

Home Forums Gutenberg acf_register_block_type display only commented data on website

Solved

acf_register_block_type display only commented data on website

  • Hello,

    I have problem with that function, it create everything inside wp blocks and there looks ok but when i open my website i see only this:

    <div class="single-post__content-fulltext">
                <!-- wp:acf/newsletterbox {
        "id": "block_61280380b14b4",
        "name": "acf\/newsletterbox",
        "data": {
            "tytul": "Bądź na bieżąco dodaj swój e-mail do newslettera",
            "_tytul": "field_6127eff7849b1",
            "opis": "",
            "_opis": "field_6127effd849b2",
            "tresc_na_przycisku": "Dodaj",
            "_tresc_na_przycisku": "field_6127f002849b3",
            "tresc_na_polu_do_uzupelnienia": "Adres e-mail",
            "_tresc_na_polu_do_uzupelnienia": "field_6127f008849b4"
        },
        "align": "",
        "mode": "preview",
        "wpClassName": "wp-block-acf-newsletterbox"
    } /-->        </div>

    This is how it looks inside functions.php

    // Register blocks for editor
    
    if( function_exists('acf_register_block_type') ) {
    	add_action('acf/init', 'my_acf_init_block_types');
    }
    function my_acf_init_block_types() {
    	// register a testimonial block.
    	acf_register_block_type(array(
    		'name'              => 'newsletterbox',
    		'title'             => __('Newsletter'),
    		'description'       => __('Szablon z formularzem newslettera'),
    		'render_template'   => 'templates/gutenberg/newsletter.php',
    		'icon'              => 'admin-comments',
    		'keywords'          => array('newsletter'),
    	));
    }

    I was looking for answer but didnt see anyone with problem like me.

  • Hey, how are you outputting the content?

    That looks like you’re outputting $post_object->post_content without first passing it through apply_filters('the_content', $post_object->post_content)

  • ok when i write that post i found the answer… inside my single-post template i add:

    apply_filters('the_content', $post->post_content);

    instead of just $post->post_content

    Topic can be closed, thanks and sorry 🙂

  • You are totally right Igladdy, thanks for your answer 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.