Elliott C. Back: Internet & Technology

Truncate Title: For Perogy

Posted in Code, My Blog, Plugins by Elliott Back on December 12th, 2004.

This plugin is for Perogy. Today she posted this interesting article, with a title slug so long you could use it to paint your walls. In fact, the title was so long that Wordpress truncated it to 200 characters!

So, I’ve written this plugin to truncate titles to a certain length–in my case, a maximum of 45 characters. What does this mean? Even mom can post on the blog, and not screw up the layout. On a technical note, it breaks titles by word and pieces them back together until they have reached the word limit, so you won’t get cut off in the middle of a great piece of vocabulary.

Feel free to download Truncate Title. It’s tiny.

This entry was posted on Sunday, December 12th, 2004 at 3:56 am and is tagged with even mom, word limit, slug, vocabulary, blog. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

9 Responses to “Truncate Title: For Perogy”

  1. Carol says:

    Thank you SOOOO much for this. I have been looking everywhere for a plugin like this. Searched the WordPress plugin directory for “truncate, limit, etc.” and could not find anything that worked…. a few of the hacks on Google didn’t work either.

    I’m using this plugin on a few client sites, but it’s funny that you mentioned Perogy — I have the same problem with my 75 year old mother…. I keep on saying, “Mom… limit your title to a few characters and keep the important keywords first…” and of course, she never remembers. :) Usually stuffed with “the, and, if, etc.” lol.

    Thanks again for this great plugin.

  2. Luv2bbq says:

    This works great with long videos titles. Thanks

  3. Amit says:

    Hi Elliot nice work…i used this work of urs to truncate movies titles and display it along with thumbnail image…Great work keep it up…

  4. Daniel says:

    Hi Elliot, can you please show us an example of how truncate titles by using “is_home” please?

    I tried this at the end of your plugin but doesn't work…

    if (is_home()) { add_filter('the_title', 'truncate_long_titles'); };

    Thank you!

  5. elliottback says:

    If you're talking about wordpress, you can just call is_home() to find that out. Or if you want other things (such as categories, etc) just make it !is_single() && !is_page.

  6. superkikim says:

    Hey…

    I don't know is you still follow this post comments.

    I want to use your plugin to truncate titles on the home page, but not on the individual post pages. I cannot find what would be the variable to identify the page. I have tried with $_SERVER["PHP_SELF"] but it returns “/index.php” for both the home page and the article page. Any time ?

  7. Joey Dehnert says:

    Thank you very much, this plugin helped out a lot. I will give credit when the site i am working on launches.

  8. Testuser says:

    soryyyyyyyyyy yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy yyyyyyyy yyyyyyyyyyyyyy yyyyyyyyy yyyyyyyyyyyyyy yyyyyyyyyyyyyyyy yyyyyyyyyyyyy yyyyyyyyyyy yyyyyyyyyyy

  9. Arthur Bahadourian says:

    Great plugin!!

    Q: How can I apply only recent entries? …the actual post page, i would like the title to stay as is.

    Thankx in advance,
    Arthur

Leave a Reply

Powered by WP Hashcash