• Hi:

    My design breaks any time any making a comment posts a URL longer than 25 characters in their first 15 words of a comment.

    http://www.mindbodyspiritjournal.com

    I am using the plug-in php c2c_get_comments to display the first
    15 words of each comment at the top of a narrow column on the index page. The long URLs blow the width of the column, confuse things and push the right-hand column off the page.

    I want to keep displaying the opening words of comments on the front page in the middle column like this.

    Is there any way to tell WordPress to reject (or hold) comments that have long URLS in them? Or to automatically link them to a word or phrase (such has “click here’)?

    Or, what else could be set up so that this doesn’t happen?

    Or, is there a way (or plug-in) that would force a linebreak/wordwrap on long words/URLS in php c2c_get_comments?

    Appreciate your experience and advice.

    Best,
    kwc

Viewing 14 replies - 1 through 14 (of 14 total)
  • wp-chunk handles long links in comments:

    http://www.village-idiot.org/archives/2006/06/29/wp-chunk/

    however thats not neccessarily going to do anything for your sidebar display. You can try it and see though

    If it were me, I would hack that so that the commenter’s name was the link to the comment.. and NOT the actual comment content itself.

    Perhaps you might like to let whoever wrote that plaugin know that there are ways to truncate long urls πŸ˜›

    Thread Starter kenwinstoncaine

    (@kenwinstoncaine)

    Trying wp_chunk right now.

    Thread Starter kenwinstoncaine

    (@kenwinstoncaine)

    Didn’t work for me. And I can’t seem to post a comment at the village idiot page. Every time I try, I get a message, “Piss off, Asshole.”

    My problem is that no URL can be longer than 25 characters. WP-Chunk seems to truncate them to about 40 characters. So they still break the page.

    Wanted to ask whether this is a variable that can be reset somehow and if so, how to do that?

    But the Village Idiot just curses at me when I try.

    Best,
    kwc

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Try adding this to your style.css file:
    #noindent ul li {
    overflow:hidden;
    }

    This should just chop the overflowing text off instead of pushing it into the other sidebar2 area. I may have gotten the location wrong there, but I think that’s correct.

    Thread Starter kenwinstoncaine

    (@kenwinstoncaine)

    Added overflow:hidden; to both sidebar1 and sidebar2. We’ll see what that does. Thanks, Otto.

    kenwinstoncaine, My apologies that you cannot leave a comment.. HOWEVER, that said.. the message you are getting is not “piss off, asshole” its “piss off spammer”. I know this because its my site, and while I am admittedly tough on comments, I am not completely rude (not every word in a sentence needs to be inflammatory) πŸ˜›

    wp-chunk is adjustable, yes. unfortunately, I am at work and unable to tell you exactly what you need to change. I should warn you though, that all wp-chunk does is “filter” the url, it doesnt actually change the url within the db, so your plugin is prolly going to be unaffected by it’s (wp-chunk’s) usage.

    If youre still needing help with this when i get home later, I will happily post the way to adjust the length at which urls are truncated.

    whooami, it does indeed say “PISS OFF A**H*LE” and I can’t leave you replies there or use the contact button – I have no idea why

    so I had to join here just to reach you πŸ˜‰

    In any case, thank you for the nice plugin but I was wondering if you might consider the way it displays trucated urls to definitely indicate it’s trucated so a novice does not try to copy it as text and get it wrong

    ie.
    bad idea:
    http://example.com/_verylongurlexample
    better visual
    http://example.com/…verylongurlexample…

    Also I was wondering if you can track down the conflict it has with the “wrap long words” plugin – not really a conflict, the urls just don’t get shortened, they get wrapped instead. I’d like both to works if possible.

    http://wp-plugins.net/plugin/word_wrap/

    (I realize that it may be the other plugin’s fault, not yours, so thanks for any insight)

    Keep up the good work!

    1. oops! yes it is, you got my 403 page, my apologies!! Ive fixed that now, thank you.

    2. if you look at the examples on my plugin page, it uses elipses to indicate that the url is shortened. In fact, the elipses are even shown in the code:

    $chunked = (strlen($urlname) > 50 && preg_match('#^(http://|ftp://|www.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -10) : $urlname;

    If youre not seeing them, and instead seeing an underscore than thats the result of something else.

    3. I havent looked at the word wrap plugin, but i can make an educated guess that it wraps *everything* so no amount of modification of wp-chunk on my part will be able to change that plugin’s default behaviour.

    on another note, shortening the point at which its truncated is only as difficult as changing the 50 to something else in that line above.

    http://wp-plugins.net/plugin/word_wrap/

    It works fine for me in WP 2.0.

    rodeohk, yes the word wrap works but my point was that it defeats the url shortening. I would like the urls shortened and THEN word wrap, not just word wrap on long urls.

    I don’t know if it’s just because of the order wordpress runs the plugins. It might have to be fixed in the word wrap plugin not the url shortening I am not sure. I suspect the answer is to combine both plugins into one.

    ermm..and I suspect I dont like that answer.

    As I stated, the word_wrap plugin is *probably* wrapping everything.

    I looked briefly at the plugin and you are able to add exclusions, based on characters:

    $wrapProhibitedChars = "([{!;,/:?}])";

    perhaps you can ask that plugin’s writer to provide whatever would be necessary to _not_wrap urls.

    Don’t plugins have a priority level?
    Perhaps I can change the url shortening to a higher priority and the word wrap to a lower one so they get executed in the prefered order?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Long URLS in comments break my design — any way to fix?’ is closed to new replies.