WordPress custom expression and its path method

Time:2020-1-12

Here is how to use it:

Step 1: Download weisay_smiley.zip, unzip it, and upload smiley and smiley.php together to the theme directory you are currently using.

DownLoad  

Step 2: add the following code to functions.php

Copy code

The code is as follows:

//Comment expression path
add_filter(‘smilies_src’,’custom_smilies_src’,1,10);
function custom_smilies_src ($img_src, $img, $siteurl){
return get_bloginfo(‘template_directory’).’/smiley/’.$img;
}

Step 3: open comments.php, search for textarea, and add the

Copy code

The code is as follows:

<?php include(TEMPLATEPATH . ‘/smiley.php’); ?>

Done, so you can easily customize the expression and expression path.

Note that when replacing the head image in smiley.php, you should pay attention to one-to-one correspondence with the name of the head image in smiley.php, otherwise it may not be displayed. Remember.