• Resolved denplaza

    (@denplaza)


    1. I type the text “….” in a post.
    2. The HTML tab of the editor also shows “….”
    3. The function the_content() returns the html code #8230; as text. (I removed the ampersand here.) The first three dots have been ‘corrected’ internally.
    I always thought that the HTML tab of the WordPress editor was the same as what the the_content() function returned.

    Character #8230 is a horizontal ellipsis but I just want the normal three dots. I’d like to ask, is there a way to prevent this without writing PHP script to alter the output of the_content()? I mean, can this be helped with a setting or another simple change?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    I think your issue might be caused by the wptexturize function. You can remove it from your theme by pasting this code into your functions.php file:

    remove_filter('the_content', 'wptexturize');

    Cheers!

    Thread Starter denplaza

    (@denplaza)

    Thanks for pointing out wptexturize. I think it’s a handy feature so I wouldn’t want to switch it off entirely for a few occasions.

    Unless someone has a more elegant solution (no offense to your option Marventus), here is what I will do. I’ll remove the ellipsis from the core code. Then, when I have more time, I’ll restore the core file and write some kind of ‘reverse’ filter that includes my exceptions… or something. Have to think a little more about it.

    Any other suggestions, thoughts, etc?

    Thread Starter denplaza

    (@denplaza)

    By the way, funny to see that the three dots in my previous post were not converted to the horizontal ellipis ?? does this forum also ommit or adjust the wptexturize option? Moderators?

    In that case, you will need to create a filter in your functions.php file:

    function user_content_replace($content) {
    	return str_replace('#8230;','...',$content);
    }
    add_filter('the_content','user_content_replace', 99);

    That should do it.

    P.S.: Remember to add the ampearsand to the character.

    Thread Starter denplaza

    (@denplaza)

    Thanks for that example Marventus.

    You are welcome.
    If you need to replace more than 1 character, str_replace accepts multiple needles and replacements as arrays.
    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How can I prevent 3 dots to be corrected to the #8230 char?’ is closed to new replies.