Support

Account

Home Forums Front-end Issues PHP code for ACF inside WordPress add_filter Reply To: PHP code for ACF inside WordPress add_filter

  • 
    add_filter(
    'hivepress/v1/templates/vendor_view_page/blocks',
    function( $blocks, $template ) {
    if (get_field('text_field')) {
      $content = get_field('text_field');
        return hivepress()->helper->merge_trees(
                [ 'blocks' => $blocks ],
                [
                    'blocks' => [
                        'page_content' => [
                            'blocks' => [
                                'custom_listings_text' => [
                                        'type'    => 'content',
                                        'content' => $content,
                                        '_order'  => 1,
                                ],
                            ],
                        ],
                    ],
                ]
            )['blocks'];
    } // end if
    },
    1000,
    2
    );