Just starting with WP and my inexperience is completely showing. When I use the function get_the_excerpt(), it only returns one excerpt for the most recent blog post, and not the other ones.

I am using a theme, so trying to work with what is already here. Here is the code in the theme-shortcodes:

if ($excerpt == '1' || ($first && $excerpt == 'featured')) {
    $output .= '<div class="post-excerpt">'. get_the_excerpt() .'</div>';

And my output code:

$output .= '<div class="post-excerpt">'. get_the_excerpt() .'</div>';

How can I make the excerpts show for all my blog posts?

I would be grateful for any help or any point in the right direction - thanks!

  • Are you using a custom query? Please share your query code and tell if the other posts variables work. – Amirition May 27 at 20:48
  • I am using a theme's custom query code which is too long to provide. Yes, the other post variables are working just fine. This one also seems to work—only populates the excerpt for the latest post and not for the other. – otterblox May 28 at 1:07
  • 2
    There’s not enough to go on in this code. You’re going to need to provide the rest. Or at least the loop section. – Jacob Peattie May 28 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.