
什么是及如何使用WordPress CLI
block_core_home_link_build_css_font_sizes ( $context )
block_core_home_link_build_css_font_sizes: 该函数用于为首页链接块生成CSS字体大小样式。它也是块编辑的核心导航块的一部分。
用CSS类和内联样式建立一个数组,定义将应用于前端的主页链接标记的字体大小。
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; }