WordPress Blog Custom Emoticon Path

WordPress Tutorial three thousand seven hundred and eighty-five

WordPress blogs have their own article or comment emoticons, and many WP bloggers have turned on the emoticons function. At the same time, many WP bloggers do not like the default emoticons, so they change other personalized and distinctive emoticons. Of course, the way to change many blogs is to directly replace the new emoticons with those of WordPress. However, if WordPress is updated, the expression will be overwritten and replaced, which is troublesome. To avoid changing the path of the lower expression.

Custom WordPress blog emoticon path:

  1. Log in to the blog background and click the "Edit" option under the "Appearance" tab to enter the theme editing interface
  2. Edit the functions.php file, and add the following function code:
     one two three four
     add_filter ( 'smilies_src' , 'custom_smilies_src' , one , ten ) ;
     function custom_smilies_src ( $img_src ,  $img ,  $siteurl ) {
         return get_bloginfo ( 'template_directory' ) . '/images/smilies/' . $img ;
     }

    The above code shows that the emoticon image is placed in the images/smilies of the theme directory. Of course, the blogger can also change to another directory

  3. Then save the file.

Tips: For a blog system with WordPress upgraded and updated so frequently, it is necessary to change the download path.

Reminder: Code from Wange Blog

Highlight: