I’ve created two universal utility loops for surfacing related content, one by post type and one by post type with a shared taxonomy term. Create them once and drop them into any single post template. No need to create custom loops for simple queries. Each loop includes optional parameters for customization and has smart defaults that make sense for its use case. Both exclude the current post automatically and default to 3 results, with an optional $limit parameter if you need more.

If you’re looking for utility loops that fetch posts by ID, parent, or relationship field, check out Utility Loops for Fetching Posts by ID in Etch.

Related Posts by Post Type

Fetches recent posts of the same post type, excluding the current post.

Loop Configuration

Create a saved loop called Related Posts (relatedPosts)

PHP

Common Use Cases

Related posts on a single post template:

HTML

Related Posts by Post Type + Taxonomy

Fetches recent posts of the same post type that share a taxonomy term with the current post, excluding the current post.

Loop Configuration

Create a saved loop called Related Posts by Taxonomy (relatedPostsByTax)

PHP

Common Use Cases

Related posts in the same category:

HTML

Related posts in the same custom taxonomy term, in this case we’ll use sector:

HTML

Notes