Thumbnails not showing in blog

The loop term in WP refers to concept of iterating over post objects and (typically) filling global variables with data of current one.

It can be identified by one of:

  • the_post() function calls (main loop)
  • $some_variable->the_post() method calls (secondary loops using WP_Query object)
  • setup_postdata( $post ) (more raw version, working with array of post objects)

In your case this doesn’t really happen and would be problematic, because rather than iterating on set of posts ($posts = get_posts() their data is completely torn apart and rewritten into custom arrays which end up in $news through which your output loops.

Really most of this would have to be rewritten to hammer it into normal WP loop.

The path of least resistance would probably be:

  1. store $p->ID with other data, when processing it
  2. use get_the_post_thumbnail() function, which accepts ID argument for post to work on, instead of relying on global variable