function translate_smiley($smiley) {}

Convert one smiley code to the icon graphic file equivalent.
Looks up one smiley code in the $wpsmiliestrans global array and returns an <img> string for that smiley.


  • string $smiley: Smiley code to convert to image.

Return values

returns:Image string for smiley.

Defined filters

  • smilies_src
    apply_filters('smilies_src', includes_url("images/smilies/$img")

Source code

function translate_smiley($smiley) {

	global $wpsmiliestrans;

	if (count($smiley) == 0) {

		return '';


	$smiley = trim(reset($smiley));

	$img = $wpsmiliestrans[$smiley];

	$smiley_masked = esc_attr($smiley);

	$srcurl = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());

	return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: