SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wordpress: smilies are not printed in the post

    hi,
    i am using a simple script which add a "quick smilies" row in the post comments

    the row shows correctly, the problem is the smilies images are not printed into the comment, but it shows only the smiles code

    have a look here please


    script code:

    PHP Code:
    <small><strong>Smilies (click to append):</strong> <br /><script type="text/javascript">
            function 
    SJB_appendSmiley(text) {
                var 
    comment=document.getElementById('comment');
                
    comment.value=comment.value+' '+text+' ';
            };
    document.write('<a href="javascript:SJB_appendSmiley(\':evil:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_evil.gif" alt=":evil:" class="wp-smiley" title=":evil:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':lol:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_lol.gif" alt=":lol:" class="wp-smiley" title=":lol:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':grin:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":grin:" class="wp-smiley" title=":grin:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':smile:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_smile.gif" alt=":smile:" class="wp-smiley" title=":smile:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':neutral:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_neutral.gif" alt=":neutral:" class="wp-smiley" title=":neutral:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':sad:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_sad.gif" alt=":sad:" class="wp-smiley" title=":sad:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':mad:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_mad.gif" alt=":mad:" class="wp-smiley" title=":mad:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':arrow:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_arrow.gif" alt=":arrow:" class="wp-smiley" title=":arrow:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':?:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_question.gif" alt=":?:" class="wp-smiley" title=":?:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':shock:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_eek.gif" alt=":shock:" class="wp-smiley" title=":shock:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':eek:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_surprised.gif" alt=":eek:" class="wp-smiley" title=":eek:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':cool:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_cool.gif" alt=":cool:" class="wp-smiley" title=":cool:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':mrgreen:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_mrgreen.gif" alt=":mrgreen:" class="wp-smiley" title=":mrgreen:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':wink:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_wink.gif" alt=":wink:" class="wp-smiley" title=":wink:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':twisted:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_twisted.gif" alt=":twisted:" class="wp-smiley" title=":twisted:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':roll:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_rolleyes.gif" alt=":roll:" class="wp-smiley" title=":roll:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':razz:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_razz.gif" alt=":razz:" class="wp-smiley" title=":razz:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':???:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_confused.gif" alt=":???:" class="wp-smiley" title=":???:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':oops:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_redface.gif" alt=":oops:" class="wp-smiley" title=":oops:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':idea:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_idea.gif" alt=":idea:" class="wp-smiley" title=":idea:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':cry:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_cry.gif" alt=":cry:" class="wp-smiley" title=":cry:" />');
    document.write('</a> ');

    document.write('<a href="javascript:SJB_appendSmiley(\':!:\')">');
    document.write('<img src="http://www.sancarlobasket.com/wp-includes/images/smilies/icon_exclaim.gif" alt=":!:" class="wp-smiley" title=":!:" />');
    document.write('</a> ');
    </script><noscript>You could see clickable smiley faces here if you had JavaScript activated.</noscript></small><br /> 
    i've added this in the comments.php

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    The smilie code is being added OK. But even when manually entered the smilie code doesn't get parsed into an emoticon image.
    AFAIK, WordPress should be at least showing smilies when typed in, even without the smilie bar script stuff. Maybe you have a plugin that's filtering the comments?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    The smilie code is being added OK. But even when manually entered the smilie code doesn't get parsed into an emoticon image.
    AFAIK, WordPress should be at least showing smilies when typed in, even without the smilie bar script stuff. Maybe you have a plugin that's filtering the comments?
    i disabled all the plugins to check and still doenst work, what else could i try?

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I looked at view-source. It's something like

    form tag
    inputs
    script
    submit

    But there is no closing form tag. If you can find out why it's missing it may fix things. BTW, I would keep the javascript outside of the form tags.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    I looked at view-source. It's something like

    form tag
    inputs
    script
    submit

    But there is no closing form tag. If you can find out why it's missing it may fix things. BTW, I would keep the javascript outside of the form tags.
    where should i close the form tag?
    can u edit the above code for me please?

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I don't see a problem with your code, but I think the problem is from how/where you hacked the comment.php file.

    If you replace the comments.php file with the back-up file (or comment out your modification code), do the smilie images in the existing comments then get rendered?

    WordPress is fairly complex. Hacking core files does not always work as expected and sometimes it's easier to put the code in a plugin so it ties in with WordPress' filtering.

    The comment.php file is quite lengthy, where did you hack it?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •