• I am trying this on the_title():

    <?php substr(the_title('', '', FALSE), 0, 22); ?>..

    However it won’t work.. It doesn’t show the title at all, but when I do this:

    <?php substr(the_title(), 0, 22); ?>..

    It shows the title, but doesn’t shorten it. I need to show only the first 22 characters.. How do I go about doing that?..

Viewing 4 replies - 1 through 4 (of 4 total)
  • you need to echo the substr:

    <?php echo substr(the_title('', '', FALSE), 0, 22); ?>

    Thread Starter lilmousiee

    (@lilmousiee)

    Ah wow.. thanks. I should have caught that >.<

    Thread Starter lilmousiee

    (@lilmousiee)

    Do you have any idea on how to do that with the_content as well? I know it accepts two parameters. Right now I have ”, FALSE and it doesn’t strip them and I am echoing it out.

    Thread Starter lilmousiee

    (@lilmousiee)

    Figured it out.

    function custom_excerpt_length($length) {
    	return 30;
    }
    add_filter('excerpt_length', 'custom_excerpt_length', 999);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shorten the_title()’ is closed to new replies.