WordPress.org

Ready to get started?Download WordPress

Forums

[How to] wp_grins in 2.1 (11 posts)

  1. The old instructions won't work for 2.1, as a number of changes have been made.

    To get your clickable smilies into the edit page, you now need to edit wp-includes\general-template.php. As of the latest RC code, look around line 825 for:

    <script type="text/javascript">edToolbar()</script>

    On a new line below this, add:

    <?php if (function_exists('wp_grins')) wp_grins(); ?>

    Save and upload the file, making sure you kept a copy of the unedited version.

    The next change is because of the way smilies are being translated. Amongst other things, if your codes are not surrounded by spaces, they may not become smilies in your posts. To fix this, you need to edit wp-grins.php, so that it pads the smiley codes with spaces. Find line 34 and change it to this:

    $grins .= '<img src="'.get_settings('siteurl').'/wp-includes/images/smilies/'.$grin.'" alt="'.$tag.'" onclick="grin(' '.$tag.' ');"/> ';

    The only change (other than the same change of path needed for WP 2.0) is that this will insert spaces before and after the value of $tag.

    This won't help with old posts and comments - their smilies may or may not appear, depending on spacing, and other factors.

  2. If you do find old posts' smilies are appearing as ":)" or ":(" instead of your nice emoticons, first make sure that they're in the right place:

    wp-includes/images/smilies

    If they are, then you'll have to edit the posts to make them appear. If you have :) defined as a smile, it may not appear. To make sure it does appear, it needs to have spaces around it. So you'd have to change every instance of :) with [space]:)[space]. (Actual spaces, not the word space, of course!) Doing that by hand could take ages.

    However, if you are careful and you have at least one backup of your database, you can use the Search and replace plugin to edit all your posts and comments in one go. It worked on my test site.

    If you do want to try this, make sure you have a backup of your database first. It should be perfectly safe, but odd things can happen...

  3. Alex has now updated WP-Grins so that it not only works with WP 2.0.x and WP 2.1, but it is no longer necessary to edit any core files.

    http://alexking.org/blog/2007/01/25/wp-grins-13

    Woo hoo!

  4. Hadiya
    Member
    Posted 7 years ago #

    Unlike the old this new version does not appear to allow you to add clickable smilies for commenters at your site. How can you make the WP-Grins work for commenters now?

  5. Cristina
    Member
    Posted 7 years ago #

    Even though I have the latest version of this plug-in, some of my smilies are still not showing up when they used to before the upgrade to 2.1

  6. SpiffyMere
    Member
    Posted 7 years ago #

    Hey, I'm having the problem with needing the space before the smilies in the wp-grins. I copied and pasted the code given in the first post here, but I got T_CONSTANT_ENCAPSED_STRING error from it. I'm not too familiar with PHP, so I'm not exactly sure what's wrong. If someone could please correct the code or tell me another way to have the space inserted, please tell! Thanks. =)

  7. Looks like the forum mangled the code a bit. Let's try again:

    $grins .= '<img src="'.get_settings('siteurl').'/wp-includes/images/smilies/'.$grin.'" alt="'.$tag.'" onclick="grin(\' '.$tag.' \');"/> ';
  8. That did it - the first version lost the \ characters.

  9. SpiffyMere
    Member
    Posted 7 years ago #

    Perfect! Thank you! =)

  10. forger
    Member
    Posted 7 years ago #

    It works with comments, BUT when i post an article and use wp-grins, I click on one smiley and press the publish button, but all i see is:
    :rockon: :saddam: :sad:
    The problem seems to be solved when hit the backspace and type the first ":", as if I'm really "typing" the string. Looks like wordpress doesn't parse the grins as smilies :(

    (This is not 2.1 material since there still are problems)

  11. iamkacom
    Member
    Posted 7 years ago #

    I cant even get mine to work, can someone tell me how, I followed the instructins the best I could and after that I noone was able to add comments to the site so I took out wp_head from comments.php and changed id = "comment" back to id = "comments" and now people can add comments again. The instructions are not in depth enough for people to use it.

Topic Closed

This topic has been closed to new replies.

About this Topic