# AffiStyle – Affiliate Product Cards & Click Tracker

[![WordPress Version](https://img.shields.io/badge/WordPress-5.8%2B-blue.svg)](https://wordpress.org/plugins/affistyle/)
[![PHP Version](https://img.shields.io/badge/PHP-7.4%2B-purple.svg)](https://www.php.net/)
[![License](https://img.shields.io/badge/License-GPLv2%2Bor%2Blater-green.svg)](https://www.gnu.org/licenses/gpl-2.0.html)

**AffiStyle** is a lightweight WordPress plugin designed to create structured affiliate product review boxes, pros & cons lists, and rating displays.

Engineered natively for the Gutenberg Block Editor and Classic Shortcodes, AffiStyle gives publishers, affiliate marketers, and product reviewers the tools to showcase product recommendations cleanly with local click tracking.

---

## 🌟 Core Features Included Free

- **Gutenberg Native Block & Shortcode** — Insert product boxes anywhere using the `[affistyle_box id="123"]` shortcode or native Gutenberg block (`affistyle/aff-box`).
- **2 Responsive Designer Layouts** — Clean, conversion-tested card styles (Modern Product Card & Minimalist Review Box) built to display ratings, features, and buy buttons across all screen sizes.
- **Pros & Cons List Builder** — Highlight product strengths and drawbacks with responsive side-by-side icon lists.
- **Admin-Controlled Product Scores & Badges** — Set custom star ratings (0.0 – 5.0), review count text, and promotional badges (e.g., "Editor's Choice").
- **Local Click Analytics & Date Filtering** — Track total affiliate link clicks with 7/30/60/90-day and custom date range filters directly in your local WordPress database without third-party tracking scripts.
- **Schema.org Structured Data Ready** — Automatically outputs clean JSON-LD Product and AggregateRating schema markup for search engine rich snippets.
- **Zero Script Bloat & Core Web Vitals Ready** — Loads minimal CSS conditionally only on pages where an affiliate card is rendered.

---

## 💻 Tech Stack & Standards

- **Core**: PHP 7.4+, WordPress Core APIs
- **Database**: Custom `{$wpdb->prefix}affistyle_clicks` table with prepared SQL queries (`$wpdb->prepare()`)
- **Frontend**: Vanilla ES6 JavaScript (Zero jQuery dependencies), CSS Grid & Flexbox
- **Security**: Nonce verification and capability checks on all submission and tracking endpoints
- **Internationalization**: 100% i18n ready with `'affistyle'` text domain

---

## 📥 Installation

1. Upload the `affistyle` folder to the `/wp-content/plugins/` directory, or install it via **Plugins > Add New** in WordPress admin.
2. Activate the plugin through the **Plugins** menu.
3. Create affiliate boxes under **AffiStyle > Add New Box**.
4. Embed cards into posts using the Gutenberg Block or `[affistyle_box id="123"]` shortcode.

---

## 📄 License & Attribution

Distributed under the **GPLv2 or later** license. See `LICENSE.txt` for details.

- **Author**: Dreainno, mayureshpandit12
- **Author URI**: [https://dreainno.online/](https://dreainno.online/)
- **Plugin URI**: [https://affistyle.shop](https://affistyle.shop)