print_emoji_styles() WordPress Function

The print_emoji_styles() function was introduced in Wordpress 4.2 and allows for a stylesheet to be generated for displaying Emoji characters on a website. This is particularly useful for websites that want to support Emoji characters but don't want to use the WebKit-based Emoji fonts.

print_emoji_styles() #

Prints the important emoji-related styles.


Source

File: wp-includes/formatting.php

function print_emoji_styles() {
	static $printed = false;

	if ( $printed ) {
		return;
	}

	$printed = true;

	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
	?>
<style<?php echo $type_attr; ?>>
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;
}
</style>
	<?php
}


Top ↑

Changelog

Changelog
VersionDescription
4.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More