wpseek.com
WordPress开发者和主题制作者的搜索引擎



block_core_home_link_build_css_font_sizes › WordPress Function

Sincen/a
已弃用n/a
block_core_home_link_build_css_font_sizes ( $context )
参数:
  • (array) $context Home link block context.
    Required: Yes
返回:
  • (array) Font size CSS classes and inline styles.
定义在:
文档:

Build an array with CSS classes and inline styles defining the font sizes which will be applied to the home link markup in the front-end.



源码

function block_core_home_link_build_css_font_sizes( $context ) {
	// CSS classes.
	$font_sizes = array(
		'css_classes'   => array(),
		'inline_styles' => '',
	);

	$has_named_font_size  = array_key_exists( 'fontSize', $context );
	$has_custom_font_size = isset( $context['style']['typography']['fontSize'] );

	if ( $has_named_font_size ) {
		// Add the font size class.
		$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
	} elseif ( $has_custom_font_size ) {
		// Add the custom font size inline style.
		$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
	}

	return $font_sizes;
}