================================================================
  SmartFAQ AI — WordPress Plugin  v1.0.0
  SEO-Optimised FAQ Generator with FAQ Schema
================================================================

WHAT IS THIS PLUGIN?
────────────────────
SmartFAQ AI uses OpenAI's GPT-4o-mini to automatically read
your WordPress post or page content and generate relevant,
search-intent-focused FAQs. It then injects Google-compliant
FAQ Schema (JSON-LD) into your page <head>, helping you
capture FAQ rich results in Google Search.

This is one of the highest-ROI SEO tactics in 2025:
• FAQ rich results increase click-through rates significantly
• Google shows expanded FAQ snippets directly in search results
• Takes 30 seconds per page instead of hours of manual writing


REQUIREMENTS
────────────
• WordPress 6.0+
• PHP 7.4+
• An OpenAI API key (https://platform.openai.com/api-keys)
• Active internet connection on your WordPress server


INSTALLATION
────────────
1. Download the smartfaq-ai.zip file.
2. In your WordPress admin, go to:
   Plugins → Add New → Upload Plugin
3. Upload smartfaq-ai.zip and click "Install Now".
4. Click "Activate Plugin".


QUICK START (5 minutes)
────────────────────────
Step 1 — Add your API Key
   Go to: Settings → SmartFAQ AI
   Paste your OpenAI API key (starts with sk-...)
   Click "Save Settings"

Step 2 — Open any Post or Page
   Go to Posts → All Posts → click any post to edit it.
   Scroll down to the "⚡ SmartFAQ AI" meta box.

Step 3 — Generate FAQs
   Click the "✨ Generate FAQs from Content" button.
   Wait ~5–10 seconds. The AI reads your content and
   generates relevant FAQs automatically.

Step 4 — Review & Edit
   Read through each FAQ. Click on any question or answer
   to edit it. Add or remove FAQs as needed.

Step 5 — Save
   Click "Update" (or "Publish") to save the post.
   FAQ Schema is immediately active on your live page!

Step 6 — Verify Schema (optional)
   Go to: https://search.google.com/test/rich-results
   Paste your page URL and check for FAQ rich results.


DISPLAY OPTIONS
────────────────

Option A — Shortcode (recommended for manual placement)
   Add [smartfaq] anywhere in your post/page content.
   
   Available parameters:
   [smartfaq]                          — default accordion
   [smartfaq title="Got Questions?"]   — custom heading
   [smartfaq style="minimal"]          — borderless style
   [smartfaq style="boxed"]            — filled box style
   [smartfaq post_id="42"]             — FAQs from another post

Option B — Auto-display
   Go to Settings → SmartFAQ AI and enable
   "Auto-display FAQs in content".
   FAQs will automatically appear at the end of every post
   that has FAQs saved.

Option C — Schema only (no visual accordion)
   Leave both options above disabled.
   FAQ Schema will still be injected in <head> for Google,
   but no accordion will appear on the page.
   (This is the default — Schema on, display off.)


SETTINGS REFERENCE
───────────────────
┌─────────────────────┬──────────────────────────────────────┐
│ Setting             │ Description                          │
├─────────────────────┼──────────────────────────────────────┤
│ OpenAI API Key      │ Your sk-... key from OpenAI          │
│ FAQs to Generate    │ How many FAQs per generation (3–10)  │
│ Auto-inject Schema  │ Add JSON-LD to <head> automatically  │
│ Auto-display FAQs   │ Append accordion to post content     │
└─────────────────────┴──────────────────────────────────────┘


OPENAI COST ESTIMATE
─────────────────────
The plugin uses gpt-4o-mini — the most affordable model.
Approximate cost per FAQ generation:
• Short post (500 words):   ~$0.0003 (less than 1/10 of a cent)
• Long post (2000 words):   ~$0.001  (1/10 of a cent)

For 100 posts: roughly $0.05–$0.10 total.


DEVELOPER NOTES
────────────────
Filter to support custom post types:
  add_filter('sfai_post_types', function($types) {
      $types[] = 'product';  // add WooCommerce products
      return $types;
  });

Get FAQs programmatically:
  $faqs = SFAI_Schema::get_faqs( $post_id );
  // Returns array of ['question' => '...', 'answer' => '...']

The FAQs are stored in post meta key: _sfai_faqs


TROUBLESHOOTING
────────────────
"Post content is too short"
→ Add more content to your post (at least ~80 characters)
  before generating FAQs.

"OpenAI API key is not configured"
→ Go to Settings → SmartFAQ AI and enter your API key.

"Permission denied" in API call
→ Check your OpenAI account has billing set up and credits.

FAQs not showing in Google
→ Use https://search.google.com/test/rich-results to validate.
→ Google can take days/weeks to index new schema.

Button does nothing
→ Open browser console (F12) for JavaScript errors.
→ Make sure jQuery is loading (it's included with WordPress).


CHANGELOG
──────────
v1.0.0 (2025)
  - Initial release
  - OpenAI GPT-4o-mini integration
  - FAQ Schema (JSON-LD) auto-injection
  - Drag-sortable FAQ meta box
  - [smartfaq] shortcode with 3 styles
  - Auto-display option
  - Settings page with toggle switches


LICENSE
────────
SmartFAQ AI is released under the GNU General Public License
v2 or later. See https://www.gnu.org/licenses/gpl-2.0.html


SUPPORT
────────
For issues or feature requests, open a ticket at your 
plugin support channel.

================================================================
