
wp_enqueue_scripts – 如何在WordPress中实现资源队列
block_template_part ( $part )
block_template_part: 这个函数类似于WordPress中的get_template_part函数,但用于加载特定于块的模板: 该函数需要两个参数:区块类型(例如”core/paragraph”)和模板名称(例如”content”)。
打印区块模板部分。
function block_template_part( $part ) { $template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' ); if ( ! $template_part || empty( $template_part->content ) ) { return; } echo do_blocks( $template_part->content ); }