• Hi, I really can’t have this to work. I found the excerpt code part on the forum but it doesn’t work. Help?

    <?php
    	$args = array( 'numberposts' => '4' );
    	$recent_posts = wp_get_recent_posts( $args );
    	foreach( $recent_posts as $recent ):
    		get_permalink($recent["ID"]);
    
    ?>
    		<div class="col-md-3">
    			<center>
    				<i class="fa fa-microphone"></i>
    				<img class="img-rect" width="160" height="100" alt="" src="/img/2.png">
    
    				<h3> <?php echo $recent["post_title"] ?></h3>
    
    				<p class="text-muted"><?php if( !empty($recent->post_excerpt) ) {
    					the_excerpt();
    				} else {
    					echo wp_trim_words(get_the_content(), 20); }?></p>
    			</center>
    		</div>
    <?php endforeach; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘excerpt of recent posts’ is closed to new replies.