Support » Plugins » Limit chars in the_title();

  • Hello.

    I have a section in my WP 2.7 blog with Recent Posts, but due to design i only want to show the first 50 chars of the_title(); of the posts.

    Is that possible ?
    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Assuming in a post loop, like

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    then this in the loop would work:
    <?php echo ‘shortened title ‘ .substr($post->post_title,0,50) ; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Limit chars in the_title();’ is closed to new replies.