=== Default Featured Image Fallback ===
Contributors:      snehalpancholi
Tags:              featured image, fallback image, thumbnail, default thumbnail, post thumbnail
Requires at least: 6.0
Tested up to:      6.7
Requires PHP:      8.1
Stable tag:        1.0.0
License:           GPL-2.0+
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Show an admin-chosen fallback image wherever a post has no featured image set — transparently compatible with all standard WordPress thumbnail functions.

== Description ==

**Default Featured Image Fallback** lets you choose one image from your Media Library that automatically appears as a featured image for any post or page that does not have one set.

It works at the filter level, so every theme, page builder, and plugin that calls standard WordPress thumbnail functions — `get_the_post_thumbnail()`, `has_post_thumbnail()`, `the_post_thumbnail()` — will see the fallback without any template modifications.

**Key features:**

* Choose a fallback from your existing Media Library in seconds
* Works per post type — enable it for posts, pages, or any public custom post type
* Optionally applies in RSS feeds
* Admin post-list column shows a thumbnail preview with a "fallback" badge so you know at a glance which posts use the fallback
* Live image preview when picking from the media library
* No JavaScript framework required — 100% vanilla JS
* Clean uninstall — removing the plugin deletes only its own settings

== Installation ==

1. Upload the `default-featured-image` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **Settings → Default Featured Image**.
4. Click **Choose Image** and select the image you want to use as the fallback.
5. Check the post types you want the fallback to apply to.
6. Click **Save Settings**.

That is all. The fallback will now appear everywhere WordPress renders a featured image for posts without one.

== Frequently Asked Questions ==

= Does this plugin modify the database (post meta)? =

No. The fallback is applied at runtime using WordPress filters (`post_thumbnail_id`, `has_post_thumbnail`, `post_thumbnail_html`). No post meta is written, no posts are modified. The only data stored is the plugin's own settings in `wp_options` under `addlc_dfi_options`.

= Does it work with WooCommerce product images? =

WooCommerce product gallery images are separate from the featured image system. The fallback applies to the featured image (`_thumbnail_id`) on the `product` post type if you check "Product" in the post-type list on the settings page. It will not affect secondary gallery images.

= Will this override a theme's custom thumbnail logic? =

This plugin hooks into core WordPress thumbnail filters. If a theme bypasses these filters (for example, by calling `get_post_meta( $id, '_thumbnail_id', true )` directly instead of using `get_post_thumbnail_id()`), the fallback will not apply for that theme's custom code. Themes that follow WordPress standards are fully supported.

= Can I use a different fallback image per category or post type? =

Version 1.0.0 supports one global fallback image with per-post-type enable/disable. Per-category or per-taxonomy fallbacks are planned for a future release.

= Will deactivating the plugin restore the original behaviour immediately? =

Yes. The fallback is applied purely through WordPress filters at request time. Deactivating the plugin removes all filters and the original thumbnail behaviour is restored instantly, with no database cleanup required.

= Does the fallback image appear in the block editor (Gutenberg)? =

The block editor's featured image panel reads the actual post meta directly, so the editor UI will correctly show "No featured image" for posts without one. The fallback is applied on the front-end and in the admin post-list column only.

= Is the original media file deleted when the plugin is uninstalled? =

No. The image you chose as the fallback lives in your Media Library and is owned by you. Uninstalling this plugin only removes the plugin's settings from `wp_options`. Your image file is untouched.

== Screenshots ==

1. **Settings page** — Choose your fallback image and configure which post types use it.
2. **Admin post list** — The thumbnail column shows the fallback image with a "fallback" badge.
3. **Front-end** — A post without a featured image displays the fallback transparently.

== Changelog ==

= 1.0.0 =
* Initial release.
* Admin settings page with media library image picker and live preview.
* `post_thumbnail_id`, `has_post_thumbnail`, and `post_thumbnail_html` filters for transparent front-end fallback.
* Per-post-type enable/disable.
* RSS feed support toggle.
* Admin post-list thumbnail column with fallback badge.
* Clean uninstall.
* AddonLogic automatic update integration.

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade steps required.
