acf_block_render_template()
Locate and include an ACF block's template.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
acf_block_render_template( $block, $content, $is_preview, $post_id, $wp_block, $context );
- $block(массив) (обязательный)
- The block props.
- $content (обязательный)
- -
- $is_preview (обязательный)
- -
- $post_id (обязательный)
- -
- $wp_block (обязательный)
- -
- $context (обязательный)
- -
Список изменений
С версии 6.0.4 | Введена. |
Код acf_block_render_template() acf block render template ACF 6.0.4
function acf_block_render_template( $block, $content, $is_preview, $post_id, $wp_block, $context ) { // Locate template. if ( isset( $block['path'] ) && file_exists( $block['path'] . '/' . $block['render_template'] ) ) { $path = $block['path'] . '/' . $block['render_template']; } elseif ( file_exists( $block['render_template'] ) ) { $path = $block['render_template']; } else { $path = locate_template( $block['render_template'] ); } // Include template. if ( file_exists( $path ) ) { include $path; } }