Related Posts
Automatically display related posts at the end of your articles based on shared tags and categories. Keep visitors reading longer by suggesting relevant content they might enjoy.
Use Cases
- Increase page views by suggesting more content after readers finish an article
- Reduce bounce rate by giving visitors a reason to stay on your site
- Surface older content that’s still relevant to current readers
- Create a “you might also like” section automatically
How It Works
- The module analyzes tags assigned to the current post
- If no tags, it falls back to categories
- Finds other posts sharing those tags or categories
- Displays them in an attractive grid at the end of your content
- Posts are shown randomly from the matches for variety
Where to Find It
Location: Enable the module, configure display options, and related posts appear automatically after your content. Use [related_posts] for manual placement.
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
| Number of Posts | Number | 6 | How many related posts to show |
| Grid Columns | Select | 3 | Number of columns in the grid |
| Auto Display | Toggle | On | Automatically show after content |
| Show Thumbnails | Toggle | On | Display featured images |
Display Recommendations
For the best visual layout, match your post count to your columns:
| Columns | Recommended Posts | Result |
|---|---|---|
| 2 | 2, 4, 6 | Even rows |
| 3 | 3, 6, 9 | Even rows |
| 4 | 4, 8 | Even rows |
Shortcode
For manual placement or custom layouts:
[related_posts]Shortcode Options
| Shortcode | Description |
|---|---|
[related_posts] | Use default settings |
[related_posts count="3"] | Show 3 posts |
[related_posts columns="2"] | 2-column layout |
[related_posts count="4" columns="2"] | 4 posts in 2 columns |
In Theme Templates
<?php echo do_shortcode('[related_posts count="6" columns="3"]'); ?>
How Matching Works
The module finds related posts using this logic:
- First choice: Tags — Posts sharing the same tags are most closely related
- Fallback: Categories — If no tags, uses category matches instead
- Exclusion — The current post is never shown in its own related posts
- Randomization — Results are randomized for variety on repeat visits
Best Practices for Better Matches
To get the most relevant related posts:
- Use tags consistently — Apply specific topic tags to every post
- Be specific — Tags like “WordPress security” work better than just “WordPress”
- Use multiple tags — 3-5 tags per post gives more matching opportunities
- Categorize appropriately — Broad categories help as a fallback
Styling
The related posts section uses the class switchboard-related-posts. Customize with CSS:
/* Container */
.switchboard-related-posts {
margin: 48px 0;
padding: 40px 0;
border-top: 2px solid #e5e7eb;
}
/* Section heading */
.switchboard-related-posts h3 {
font-size: 18px;
font-weight: 600;
margin-bottom: 24px;
}
/* Grid layout */
.related-posts-grid {
display: grid;
gap: 24px;
}
/* Individual cards */
.related-post-card {
background: #fff;
border-radius: 8px;
border: 1px solid #e5e7eb;
overflow: hidden;
}
/* Card hover effect */
.related-post-card:hover {
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
transform: translateY(-2px);
}
/* Thumbnails */
.related-post-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Post title */
.related-post-card h4 {
font-size: 16px;
font-weight: 600;
margin: 0 0 8px 0;
}Responsive Behavior
The grid automatically adjusts for smaller screens:
- Desktop: Uses your configured column count
- Tablet (768px): 2 columns
- Mobile (480px): 1 column
FAQ
Why aren’t any related posts showing?
Related posts require matching tags or categories. Check that:
- Your post has tags assigned
- Other posts share those tags
- If using categories as fallback, other posts share the category
- The minimum number of matching posts exists
Can I show related posts on pages too?
The auto-display feature works on single posts. For pages, use the shortcode[related_posts] in your page content. Note that pages need categories or tags assigned to find matches.Why do I see different posts each time?
Related posts are randomized from the pool of matches. This provides variety for returning visitors and ensures more of your content gets exposure over time.Can I exclude certain posts from appearing?
Currently, any published post with matching tags/categories can appear. To exclude posts, you can remove the relevant tags or categories from posts you want to hide.Does this affect page load speed?
The query is optimized and cached by WordPress. Impact is minimal — usually just a few milliseconds for the database query.Use specific tags rather than generic ones. “Email Marketing Tips” will surface better related content than just “Marketing.”
If a post has no tags AND no categories (other than Uncategorized), no related posts will be shown. Always tag your content for the best results.
Get access to all 147 modules with a single license