# Clickable Featured Image

- Contributors: basicus
- Donate link: https://devenia.com/
- Tags: featured image, clickable image, image link, lightbox, post thumbnail
- Requires at least: 5.4
- Tested up to: 7.0
- Requires PHP: 7.4
- Stable tag: 1.1.3
- License: GPLv2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html

Make WordPress featured images clickable. Link post thumbnails to the full-size image, attachment page, or post permalink.

== Description ==

Clickable Featured Image fixes a common WordPress problem: featured images often look clickable, but nothing happens when visitors click them.

Activate the plugin and featured images become useful links:

- On single posts and pages, featured images link to the full-size image file by default, which works well with common lightbox plugins.
- If the image already displays the full-size file, the plugin leaves it unlinked instead of opening the same image again.
- In Query Loop blocks, featured images link to the post by default.
- In classic theme archive loops, the plugin leaves thumbnail markup to the theme when the theme may add its own post link.
- If a theme or block already links the featured image, the plugin leaves it alone to avoid duplicate links.

The default setup is still zero configuration, but version 1.1.0 adds a small Settings screen for sites that need more control.

== Features ==

- Make post featured images clickable
- Link single-post featured images to the full-size image file
- Skip pointless same-image links when the displayed single featured image is already the full-size image
- Link Query Loop featured images to the post permalink
- Avoid duplicate or nested archive image links when the theme owns the post thumbnail link
- Optional attachment-page or no-link behavior on single posts
- Optional no-link behavior on archives
- Enable only the post types you want
- Works with the core Featured Image block and Query Loop block
- Tested with GeneratePress, Twenty Twenty-Four, and common lightbox workflows
- Lightweight: no front-end JavaScript unless Meow/Lightbox compatibility is needed

== When to use it ==

Use this plugin when:

- Your Query Loop thumbnails should link to posts.
- Your single-post featured image should open in a lightbox.
- Your theme displays featured images but does not make them clickable.
- You want a small plugin instead of a full gallery or lightbox suite.

== Settings ==

Go to Settings > Clickable Featured Image.

Available settings:

- Single posts and pages: full-size image file, attachment page, or do not link.
- Archives and query loops: post permalink or do not link.
- Post types: choose which public post types with featured image support should be affected.

Defaults match the original plugin behavior for single posts and Query Loop blocks. Classic theme archives are handled conservatively so themes can keep their own thumbnail permalink markup without duplicate links.

== Installation ==

1. Install the plugin from Plugins > Add New in your WordPress admin.
2. Activate the plugin.
3. Optional: go to Settings > Clickable Featured Image to adjust link behavior.

== Frequently Asked Questions ==

= Does the plugin have a Settings page? =

Yes. Go to Settings > Clickable Featured Image. The defaults work without configuration.

= Will this plugin work with my lightbox plugin? =

The default single-post behavior links the featured image to the full-size image file, which is the link format many lightbox plugins expect. It has been tested with "Lightbox for Gallery & Image Block" and Meow Lightbox style workflows.

= Does this replace a lightbox plugin? =

No. This plugin makes featured images clickable. If you want an overlay/modal lightbox, keep using your preferred lightbox plugin.

= Will this plugin work with block themes and Query Loop blocks? =

Yes. It checks the core Featured Image block and avoids wrapping images that are already linked by the block or theme.

= Will this plugin work with any WordPress theme? =

It should work with most themes that use standard WordPress featured image output. It has been tested with GeneratePress and Twenty Twenty-Four.

= Can I disable it for pages or custom post types? =

Yes. Version 1.1.0 adds post type checkboxes on the settings page.

== Screenshots ==

1. Featured image on a single post linking to the full-size image for lightbox use.
2. Featured images in a Query Loop linking to their posts.
3. Settings screen for single-post behavior, archive behavior, and post types.

== Changelog ==

= 1.1.3 =
* Fixed: Classic theme archive thumbnails are no longer wrapped inside `post_thumbnail_html`, preventing invalid nested links when the theme adds the post permalink around the thumbnail.
* Improved: Query Loop featured images can still be linked by the plugin when the core Featured Image block is not already linked.

= 1.1.2 =
* Improved: Single featured images are no longer linked when the media-file link would open the same image instead of a larger version.

= 1.1.1 =
* Fixed: Single featured images now register with Gallery Block Lightbox/baguetteBox when themes render them outside normal image block containers.

= 1.1.0 =
* Added: Settings screen for single-post link target, archive link target, and enabled post types.
* Improved: WordPress.org description, screenshots, and positioning around clickable/linkable featured images.
* Improved: Added Text Domain plugin header for translation tooling.

= 1.0.13 =
* Fixed: Archive featured images using medium sizes no longer inherit browser `sizes="auto"` behavior that can render later lazy-loaded images much larger than the theme-requested size.

= 1.0.12 =
* Fixed: Explicitly reserves the configured WordPress thumbnail dimensions for archive thumbnails, preventing lazy-loaded images from expanding to full archive width before load.

= 1.0.11 =
* Fixed: Archive image links no longer force featured images to full container width, preserving theme-requested thumbnail sizes in GeneratePress archives.

= 1.0.9 =
* Fixed: Let Meow Lightbox re-register singular featured images by using `wp-image-<id>` classes instead of pre-setting `data-mwl-img-id`

= 1.0.8 =
* Fixed: Register singular featured-image containers with Meow Lightbox when themes render them outside `.entry-content`

= 1.0.7 =
* Fixed: Add `data-mwl-img-id` to singular featured images for Meow Lightbox compatibility

= 1.0.6 =
* Fixed: Prevent duplicate anchor tags on query loops when theme already wraps featured images

= 1.0.5 =
* Fixed: Added CSS to prevent layout spacing issues on archive pages with Twenty Twenty-Four theme

= 1.0.4 =
* Fixed: Avoid wrapping full block markup on archives by linking only the image/picture, reducing theme layout spacing issues

= 1.0.3 =
* Fixed: No longer breaks archive page links when theme already wraps images in links
* Fixed: Added proper URL escaping for security
* Tested compatibility with WordPress 6.9
* Updated minimum PHP requirement to 7.4

= 1.0.2 =
Fixed a syntax error in the plugin code that caused a parse error.

= 1.0.1 =
Updated stable tag and function names to follow guidelines for the Clickable Featured Image WordPress Plugin.

= 1.0 =
Initial release

== Upgrade Notice ==

= 1.1.3 =
Prevents invalid nested archive thumbnail links in classic theme loops while preserving Query Loop and single featured-image behavior.

= 1.1.2 =
Avoids pointless same-image clicks when a single featured image already displays the full-size media file.

= 1.1.1 =
Fixes single featured image lightbox behavior for sites using Gallery Block Lightbox/baguetteBox.

= 1.1.0 =
Adds a lightweight Settings screen while preserving the existing default behavior.

= 1.0.13 =
Keeps lazy-loaded archive images at the theme-requested medium size instead of letting browser auto-sizes expand them.

= 1.0.12 =
Prevents lazy-loaded archive thumbnails from expanding to full width before the image loads.

= 1.0.11 =
Fixes archive thumbnails being stretched to full width when themes request small featured-image sizes.

= 1.0.9 =
Fixes the remaining Meow integration bug by allowing the featured image to be queued dynamically instead of being skipped as already registered.

= 1.0.8 =
Completes the Meow Lightbox fix by registering featured-image header containers, so single-post featured images open correctly in the lightbox again.

= 1.0.7 =
Adds `data-mwl-img-id` to singular featured images for better Meow Lightbox compatibility.

= 1.0.6 =
Fixes duplicate link issue on query loops in Twenty Twenty-Four theme by detecting and skipping when theme already wraps images.

= 1.0.5 =
Fixes archive layout spacing issues on Twenty Twenty-Four theme by adding proper CSS for clickable featured images.

= 1.0.4 =
Fixes archive layout spacing issues in some themes by wrapping only the image/picture instead of the full block markup.

= 1.0.3 =
Fixes archive page compatibility issue. Now detects if theme already wraps images in links. Recommended update for all users.

= 1.0.2 =
Fixed a syntax error in the plugin code that caused a parse error. Please update to this version to ensure the plugin works correctly.

= 1.0.1 =
Updated stable tag and function names to follow guidelines for the Clickable Featured Image WordPress Plugin. Please update to this version to ensure compatibility with WordPress.org plugin directory.

= 1.0 =
Initial release
