render_block_core_site_tagline

函数
render_block_core_site_tagline ( $attributes )
参数
  • (array) $attributes The block attributes.
    Required:
返回值
  • (string) The render.
定义位置
相关方法
render_block_core_site_titleregister_block_core_site_taglinerender_block_core_site_logorender_block_core_imagerender_block_core_post_title
引入
-
弃用
-

render_block_core_site_tagline: 这个函数用来渲染WordPress中的网站标语块。网站标语块显示网站的标语,可以由用户自定义: 这个函数负责生成网站标语块的HTML标记。

在服务器上渲染`core/site-tagline’区块。

function render_block_core_site_tagline( $attributes ) {
	$site_tagline = get_bloginfo( 'description' );
	if ( ! $site_tagline ) {
		return;
	}
	$align_class_name   = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );

	return sprintf(
		'<p %1$s>%2$s</p>',
		$wrapper_attributes,
		$site_tagline
	);
}

常见问题

FAQs
查看更多 >