I'm focusing on redecorating my website and discover myself requiring to show publish excerpts on my small sidebar. the_excerpt() appeared such as the right factor to make use of however i am also using excerpts on my small primary website. The 55 word limit looks good on my small home page although not my sidebar. I want a method to limit what came back within the_excerpt ONLY during my sidebar.
<div id="sidebar">
<a href="<?php the_permalink(); ?>" title="Permalink to <?php the_title(); ?>">
<?php the_title() ?>
</a>
<?php the_excerpt(); ?>
</div>
I would like for within the sidebar, the excerpt length to become restricted to 30 words
You should use substr()
<div id="sidebar">
<a href="<?php the_permalink(); ?>" title="Permalink to <?php the_title(); ?>">
<?php the_title() ?>
</a>
<?php $mycontent=get_the_excerpt();
echo substr($mycontent,0,20);
?>
</div>