Integrating Custom Smileys

  • Author
    Posts
  • #72908
    naomi
    Power User

    Good evening,

    one last question for today 🙂

    I tried to integrate custom smileys using a snippet for functions.php that I have found through some research:

    add_filter( 'smilies_src', 'my_custom_smilies_src', 10, 3 );
    function my_custom_smilies_src( $img_src, $img, $siteurl ) {
        return get_stylesheet_directory_uri() . '/smilies/' . $img;
    }

    I am not quite sure what “10” and “3” do, but I uploaded 11 smileys into a new folder “smilies” that is now located in the child theme folder on my FTP (which I adjusted in the snippet). Also, I have named the smileys after the standard smileys from “/wp-includes/images/smilies/” including the ending (they actually are .png but my FTP seems to still display them properly in .gif).

    For testing purposes, I have entered a comment on my website in a private post but the entered smiley is still the standard one. I tried naming it after both the standard smiling smileys in the folder. Then, I figured that this is not really the smiley I see on my comment, but this one: 🙂

    The smiley is not part of my FTP, now I am confused of what and how to use to see my own smileys 🙂

    I am looking forward to your reply!

    Kind regards,
    Naomi

    Website: earth-renewing.com

    #73362
    Zed
    Cryout Creations mastermind

    If the location of the new files coincides with that described in the code, the new smilies should work. 10 & 3 are add_filter() parameters.

    Make sure you also clear the cache (both on the site and in your browser).


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    #73391
    naomi
    Power User

    The smileys that I have attempted to replace seem to be the standard Worpress smileys which already were not being used on the website.

    It looks to me like the smileys I try to change are your smileys (https://s.w.org/images/core/emoji/11/svg/1f642.svg, Cryout Creations)?

    My issue is that they are >not< on my FTP to be able to replace the folder with the smileys. So how do I replace them? 🙂

    #74539
    Zed
    Cryout Creations mastermind

    w.org is a WordPress-controlled domain.

    The fact that the smilies are loaded from that location may be either because of some form of caching/image optimization functionality (like that provided by Jetpack) or perhaps the WordPress team decided to “optimize” the smilies by loading them off-site.


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    #74576
    naomi
    Power User

    This is interesting. I will do some more research on that. Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Integrating Custom Smileys’ is closed to new replies.