• xroox

    (@xroox)


    Site I’m working on is https://messengers.faith

    Note that one of the posts in the loop on the homepage has a problem with word wrapping:

    Post title nbsp; character issue

    I looked at the source and noted that WP is swapping in an nbsp; character instead of my intended space character! I wouldn’t have caught it if not for the line wrapping blunder.

    If you compare the code in the other post titles, you’ll see that it appears to consistently be the last space in each string (crazy-weird huh?).

    I don’t know if this is somehow related to my theme or a plugin (seems kind of weird if that were the case, but anything’s possible), or a WordPress core concern. I have read some stuff about nbsp; characters possibly having something to do with TinyMCE… E.g. here and here.

    I looked into my theme files a bit more, and everything looks normal. The theme is just calling this in the single.php file:

    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

    Anyone know what might be going on here? Seen it before? Know of a fix or a clue? Would be great to get it resolved. ??

    Thanks friends!

    • This topic was modified 8 years ago by xroox.
    • This topic was modified 8 years ago by xroox.
Viewing 8 replies - 1 through 8 (of 8 total)
  • ThemeSumo

    (@themesumo)

    Are you certain the post title has a space between the words Relationship and Matters as everything is indicating that it is displaying the post title correctly, there shouldn’t be any need to be adding &nbsp; to your post titles.

    Let me know how you get on.

    • This reply was modified 8 years ago by ThemeSumo.
    Thread Starter xroox

    (@xroox)

    Hi ThemeSumo,

    Yes I am using a normal space character in the editor.

    Also you can see by inspecting the source code of the page that in every case, the last space in the post title has been replaced with a non break space character (nbsp;).

    It seems plausible that TinyMCE is somehow involved, as there have been numerous reports of errant nbsp; characters being inserted by Tiny. I gave two examples above, here is another: https://github.com/tinymce/tinymce/issues/2129

    The question is, what to do now?

    I can confirm that this does not happen on another WP site of mine.

    Thanks. ??

    Thread Starter xroox

    (@xroox)

    Here is a screen shot of the normal space character in the editor:

    normal space character used

    And the result on the homepage loop:

    space replaced with non breaking space character

    Thread Starter xroox

    (@xroox)

    As for plugins, I don’t see anything installed that should be getting in the way.

    Could the theme be actually impacting the TinyMCE settings (just taking a guess here).

    Thanks

    Thread Starter xroox

    (@xroox)

    Update: I have reached out to the theme author with the issue, as I have noted the issue is present on the theme demo as well, which is found at https://magnus.thefivethemes.com.

    Having the same issue with the same theme. Did you find a fix my friend?

    Hello everyone,

    you have to add this into your functions.php

    
    function after_theme_setup_23() {
    	remove_filter( 'the_title', 'widont' );
    }
    add_action( 'after_setup_theme', 'after_theme_setup_23' );
    

    this will disable filter which is doing it.

    Thread Starter xroox

    (@xroox)

    Hi, thanks aosmichenko!

    Unfortunately this didn’t do anything for me. Maybe a typo or something that you take for granted we need to customize in the code?

    Here are my results:

    Code

    Result

    Thanks ??

    • This reply was modified 7 years, 9 months ago by xroox.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WP inserting nbsp; characters for last space in post titles’ is closed to new replies.