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.

8 Responses to “Truncate Title: For Perogy”

  1. 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

  2. Testuser says:

    soryyyyyyyyyy yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy yyyyyyyy yyyyyyyyyyyyyy yyyyyyyyy yyyyyyyyyyyyyy yyyyyyyyyyyyyyyy yyyyyyyyyyyyy yyyyyyyyyyy yyyyyyyyyyy

  3. 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.

  4. 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 ?

  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. 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!

  7. 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…

  8. Luv2bbq says:

    This works great with long videos titles. Thanks

Leave a Reply

Powered by WP Hashcash