wp_enqueue_emoji_styles

函数
wp_enqueue_emoji_styles ( No parameters )

使重要的emoji相关样式排队。

function wp_enqueue_emoji_styles() {
	// Back-compat for plugins that disable functionality by unhooking this action.
	$action = is_admin() ? 'admin_print_styles' : 'wp_print_styles';
	if ( ! has_action( $action, 'print_emoji_styles' ) ) {
		return;
	}
	remove_action( $action, 'print_emoji_styles' );

	$emoji_styles = '
	img.wp-smiley, img.emoji {
		display: inline !important;
		border: none !important;
		box-shadow: none !important;
		height: 1em !important;
		width: 1em !important;
		margin: 0 0.07em !important;
		vertical-align: -0.1em !important;
		background: none !important;
		padding: 0 !important;
	}';
	$handle       = 'wp-emoji-styles';
	wp_register_style( $handle, false );
	wp_add_inline_style( $handle, $emoji_styles );
	wp_enqueue_style( $handle );
}

常见问题

FAQs
查看更多 >