php - Get Wordpress excerpt in list of posts -


i'm building custom wordpress widget/plugin return title , excerpt of post within permalink article. there struggling getting excerpt show. here current code:

<?php $args = array( 'numberposts' => '5' );  $recent_posts = wp_get_recent_posts( $args );  foreach( $recent_posts $recent ){      $categories = get_the_category($recent["id"]);      $excerpt = apply_filters('get_the_excerpt', $recent->post_excerpt);      echo '<a class="m-item  diet-and-nutrition" href="' . get_permalink($recent["id"]) . '" title="look '.esc_attr($recent["post_title"]).'" > <div class="pix"></div><div class="eyebrow"> <b>' . $categories[0]->name . '</b> / '.   $recent["post_date"].'</div> <figure>' .  get_the_post_thumbnail($recent["id"], 'full') . '<figcaption class="center"> <span> <h4>'.  $recent["post_title"].'</h4> </span> <span> <p>'.  $excerpt .'</p> </span> </figcaption> </figure> </a>'; } ?> 

it's array so:

$recent->post_excerpt 

should be:

$recent['post_excerpt']; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -