Home  >  Article  >  CMS Tutorial  >  How to replace comment emoticons on wordpress website

How to replace comment emoticons on wordpress website

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-12 09:54:593055browse

How to replace comment emoticons on wordpress website

The first method

is to use the same emoticon name and replace it with the image in the emoticon column of the WordPress site, wp-includes\images\ smilies

How to replace comment emoticons on wordpress website

Put the modified name and suffix of the emoticon into wp-includes\images\smilies

How to replace comment emoticons on wordpress website

Related recommendations: "WordPress Tutorial"

Just return to the website and refresh to see the replacement effect. This method has a disadvantage, that is, the emoticon will be replaced again when the WordPress website is upgraded.

How to replace comment emoticons on wordpress website

The second method

Put the emoticon package you prepared into the theme images\smilies. If you don’t have yourself Create a new

How to replace comment emoticons on wordpress website

# and put the following code in front of the last line of functions.php in the theme directory. Here aa is a custom name. I only wrote 2 expression tags. You can write as many expressions as you have. Also pay attention to the theme author's prompts, if there are none, please ignore them.

//自定义表情路径和名称
function custom_smilies_src($src, $img){return get_bloginfo('template_directory').'/images/smilies/' . $img;}
add_filter('smilies_src', 'custom_smilies_src', 10, 2);
    if ( !isset( $wpsmiliestrans ) ) {
        $wpsmiliestrans = array(
        ':aa:' => 'aa.gif',
        ':bb:' => 'bb.gif',
        );
    }

How to replace comment emoticons on wordpress website

How to replace comment emoticons on wordpress website

Modify the a tag in the smiley.php file in the theme directory and replace the tag and picture of your own expression. Write as many expressions as you like. This method is permanent.

How to replace comment emoticons on wordpress websiteHow to replace comment emoticons on wordpress website

The above is the detailed content of How to replace comment emoticons on wordpress website. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn