WordPress converts text emoticons to their image equivilents with a function appropriately named convert_smilies
.
To get smilies to show up, say, in text widgets, you would need to run the widget text through that convert_smilies
function. You do this by adding a filter:
<?php
add_filter( 'widget_text', 'convert_smilies' );
Of maybe you wanted to add smilies to widget titles:
<?php
add_filter( 'widget_title', 'convert_smilies' );
If you want to display smilies in recent posts, it gets a bit more tricky. The recent posts widget, for instance, uses functions like get_the_title
and such to retrieve elements of the posts.
So you could add smilies to post titles:
<?php
add_filter( 'the_title', 'convert_smilies' );
But that’s not going to allow you to conditionally make sure that smilies only show up in post titles on the sidebar.
If you’re using third-party plugins for widgets, you’re going to have to poke around their code yourself and see if there are any filters into which you can hook.
EDIT:
In your case, you probably just need to change this bit of code:
<?php echo wp_html_excerpt( $comment->comment_content, 45 ); ?>
to
<?php echo wp_html_excerpt( convert_smilies( $comment->comment_content ), 45 ); ?>