• Resolved khalidslife

    (@khalidslife)


    Hello, I am looking to edit the following code to limit the number of characters that appears for each title…

    <ul>
    <?php $recent = new WP_Query("cat=55&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark">
    <?php the_title(); ?>
    </a></li>
    <?php endwhile; ?>
    </ul>

    Can you help?

    Thanks,

    Khalid.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    you could try and replace this:
    <?php the_title(); ?>

    with this:

    <?php $limit = 10;
    echo substr(get_the_title(),0, $limit); ?>

    Thread Starter khalidslife

    (@khalidslife)

    Perfect thank you!!!!!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Limit Characters in Hard Coded Sidebar Widget’ is closed to new replies.