Home > Tech > Wordpress > How to Add New Emoticons to WordPress 2.2

How to Add New Emoticons to WordPress 2.2

I wanted to add my own emoticons to this blog so I did some digging. After reading the WordPress online documentation, and poking around myself, I figured out that the function called smilies_init() inside functions.php (located in the wp-includes subdirectory) has to be changed.  You’ll see the lines:

if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
':mrgreen:' => 'icon_mrgreen.gif',
':neutral:' => 'icon_neutral.gif',
':twisted:' => 'icon_twisted.gif',

Add your own emoticons by inserting them after the first 2 lines, like this:

if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
':)' => 'smiley.gif',
':(' => 'smiley_mad.gif',
'=)' => 'smiley_eq.gif',

You need to then place your .gif emoticons in the subdirectory located at:
\wp-includes\images\smilies

By the way, ignore the FAQ on the WordPress website because it must be for an older version of the software and it won’t work.

I added playing card suits to get ready for when I post something about poker:

<spade> <diamond> <club> <heart>

I added over 100 new emoticons. 🙂

Update:
This is not the correct way to add emoticons. The correct method is to create a plugin.