Display content With limited word

Display content With limited word

<?php
$recent = new WP_Query(‘showposts=3’); while($recent->have_posts()) : $recent->the_post();?>
<li>
<h3><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h3>
<?php
$trimexcerpt = get_the_excerpt();
$shortexcerpt = wp_trim_words( $trimexcerpt, $num_words = 20, $more = ” );
echo ‘<p>’ . $shortexcerpt . ‘</p>’;
?>
<p class=”postFooter”>by <?php the_author_posts_link(); ?> | <?php the_time(‘F jS, Y’) ?></p>
</li>
<?php endwhile;
wp_reset_query();?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s