Your problem has nothing to do with the_excerpt()
. the_excerpt()
template tag does not change its behavior by itself or change its behavior according to location. The only time the_excerpt()
changes its behavior is when you manually filter the output through a custom function.
I most probably think that all of your misery is caused by neglet :-). Neglet to what you may ask, and the simple answer is, negletting clean up after yourself when you done, ie resetting your postdata once you’ve done with your custom query
Many people neglet this unmost important function wp_reset_postdata
. This is a gloden rule, always always, whenever you create a custom query with either get_posts
or WP_Query
, you have to reset your query, otherwise every other query afterwards will be affected negatively.
So, I think by resetting your postdata after your custom query (add wp_reset_postdata
just after endforeach
), everything will be fine
Just a point of note, don’t use :
and endforeach
. It makes code difficult to read and to debug, and code editors can’t read this as well. To make things easier in the future, rather use curly brackets ({}
)