Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/poloik007/ark-related-posts/archive/refs/heads/main.zipA WordPress plugin that automatically displays related posts at the bottom of single post pages, based on shared tags. Falls back to latest posts when no tag matches are found.
Features
- Tag-based matching — finds posts that share tags with the current post
- Automatic fallback — shows latest posts when no tag matches exist
- Transient caching — 24-hour cache per post to reduce database queries
- Responsive layout — flexbox grid that collapses to a single column on mobile (≤782px)
- Featured images — displays post thumbnails alongside titles
- Zero configuration — works automatically on all single post pages after activation
Requirements
- WordPress 3.0+
- PHP 5.3+
Installation
Option 1 — Upload via WordPress Admin
- Download this repository as a
.zipfile (GitHub → Code → Download ZIP) - In your WordPress admin, go to Plugins → Add New → Upload Plugin
- Choose the downloaded
.zipfile and click Install Now - Click Activate Plugin
Option 2 — Manual FTP/SFTP Upload
- Download or clone this repository
- Upload the
ark-related-postsfolder to your server'swp-content/plugins/directory - In your WordPress admin, go to Plugins and activate Arkon related posts
Option 3 — WP-CLI
wp plugin install https://github.com/poloik007/ark-related-posts/archive/refs/heads/main.zip --activate
Usage
No configuration is needed. Once activated, the plugin automatically appends a "Related Posts" section to every single post page.
Posts must have tags assigned for tag-based matching to work. If a post has no tags, or no other posts share its tags, the section will display the three most recent posts instead.
File Structure
ark-related-posts/
├── ark-related-posts.php # Plugin entry point — registers hooks
├── class.ark-related-posts-query.php # Query logic and caching
├── view/
│ └── ark-related-posts-template.php # HTML template
├── _inc/
│ ├── src/
│ │ └── style.scss # Source styles
│ └── dist/
│ └── style.css # Compiled CSS (loaded on the front-end)
├── webpack.config.js # Build configuration
└── package.json # NPM dependencies
Development
The CSS is compiled from SCSS using Webpack and Sass.
# Install dependencies
npm install
# One-time production build
npm run build
# Watch for changes during development
npm run watch
Output is written to _inc/dist/style.css.
How It Works
- The plugin hooks into
the_contentfilter and runs only on single post pages. Ark_Related_Postsqueries for posts sharing at least one tag with the current post (up to 3 results), caching the result for 24 hours using WordPress transients.- If no tagged matches exist, it falls back to the 3 most recent posts (also cached for 24 hours).
- The
view/ark-related-posts-template.phptemplate renders the results and the HTML is appended to the post content.
Author
Gabriel Del Fiaco
License
This project is open source. See the repository for license details.