=== LivePolls ===
Contributors: livepolls
Tags: polls, voting, live polls, embed, gutenberg
Requires at least: 6.3
Tested up to: 6.9
Stable tag: 1.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed live, real-time polls on your WordPress site. Use a shortcode or the LivePolls Gutenberg block. No setup, no account required to vote.

== Description ==

LivePolls lets you embed real-time polls anywhere on your WordPress site. Visitors vote directly on your page and watch results update live without any page reload. Perfect for blogs, news sites, newsletters, and content creators who want to turn their articles into a conversation.

**Key features**

* **Gutenberg block** — search "LivePolls" in the block inserter, paste a poll URL or slug, and set an accent color
* **Shortcode** — paste `[livepolls slug="your-poll"]` or `[livepolls slug="https://livepolls.com/p/your-poll"]` into any post or page
* **Real-time results** — votes appear live without page reload (powered by WebSockets)
* **Accent colors** — match your site's branding with built-in colors or any 6-digit hex color
* **Mobile-friendly** — responsive design, works on phones, tablets, and desktops
* **Lead capture display** — shows LivePolls lead capture when it is enabled on the poll
* **No account required to vote** — zero friction for your visitors
* **Lightweight** — small local bootstrap script, no jQuery, no theme conflicts

**Who it's for**

* Bloggers who want to drive engagement on long-form articles
* Newsletter operators who embed in WordPress and email
* Publishers running a/b style reader polls
* Content creators capturing audience opinion at scale

== Installation ==

1. Download the plugin zip file (or install directly from the WordPress plugin directory)
2. Go to **Plugins > Add New > Upload Plugin** in your WordPress admin
3. Upload the zip and click **Install Now**
4. Activate the plugin

Or manually: upload the `livepolls` folder to `/wp-content/plugins/`.

For development or source installs, build the Gutenberg editor assets before packaging or uploading the plugin:

`npm install && npm run build`

The generated `build/` directory is required for the block editor. Production plugin zips should include `build/` and should not include `node_modules/`.

== Usage ==

**Using the Gutenberg block**

1. In the post editor, click the **+** button to add a block
2. Search for "LivePolls" and select the block
3. Paste your LivePolls poll URL or slug into the block or right sidebar
4. Pick an accent color to match your post

**Using the shortcode**

1. Create a poll and its options at [livepolls.com](https://livepolls.com)
2. Copy the poll URL (e.g., `https://livepolls.com/p/best-cuisine`)
3. Add the shortcode to any post or page:

`[livepolls slug="best-cuisine"]`

or:

`[livepolls slug="https://livepolls.com/p/best-cuisine"]`

To customize the accent color:

`[livepolls slug="best-cuisine" accent="#3B82F6"]`

== Screenshots ==

1. The LivePolls Gutenberg block in the editor with inline setup and the poll URL/accent color sidebar
2. A live poll embedded in a blog post with real-time vote bars
3. The shortcode in the classic editor
4. The block search result in the WordPress block inserter

== Frequently Asked Questions ==

= Do I need a LivePolls account? =

No account is needed to embed polls. Create a poll at livepolls.com and paste its URL or slug. A free LivePolls account unlocks creator features like lead capture and an admin dashboard.

= Can I embed multiple polls on one page? =

Yes. Add multiple `[livepolls]` shortcodes or LivePolls blocks with different slugs.

= How do I change the poll's appearance? =

Use the `accent` attribute (shortcode), the color picker, or the hex color field in the block sidebar to set the poll accent color. The poll automatically adapts to your site's content width.

= Does this work with page caching? =

Yes. The poll is rendered client-side after the page loads, so it works fine behind any standard WordPress caching plugin or CDN.

= Will this slow down my site? =

The plugin loads a small local bootstrap script that creates the embedded poll iframe. It does not depend on jQuery.

= Does this add external links to my public site? =

Embedded free polls may show a small "Powered by LivePolls" badge inside the LivePolls iframe. By adding the shortcode or block to a page, you are choosing to display that LivePolls embed and any branding that applies to the poll's plan. LivePolls Pro removes the badge.

= What license are the plugin assets under? =

The banners, icons, screenshots, and generated block assets included with this plugin are distributed under the same GPLv2-or-later license as the plugin.

= Is the plugin GDPR-compliant? =

The plugin itself does not store any visitor data on your WordPress site. Voting data is sent to livepolls.com (see the External services section below). For full compliance, link to the LivePolls privacy policy from your site's privacy notice.

== External services ==

This plugin embeds an iframe from livepolls.com when an embedded poll is rendered on a page. The iframe runs in the visitor's browser and communicates with livepolls.com to fetch the poll, submit votes, and stream live result updates. In the block editor, the plugin also checks the configured poll slug against livepolls.com so editors can see whether the poll exists before publishing.

**Service:** LivePolls (livepolls.com)
**What is sent:**

* The poll slug you configure in the shortcode or block
* When a visitor votes: their selected option, vote payload, anonymized duplicate-vote metadata (cookie + hashed IP), and a `source` value of `embed` for channel attribution
* The visitor's standard HTTP request metadata (user agent, language, IP address)

**What is received:**

* The poll question, options, current vote counts, and live update events via WebSocket

**When data is sent:**

During page render for a visitor viewing a page that contains the `[livepolls]` shortcode or LivePolls Gutenberg block, during vote submission, and when an editor enters a poll slug in the block sidebar so the plugin can confirm the poll exists. The plugin does not collect any data from the site owner.

**Service provider links:**

* Terms of Service: [https://livepolls.com/terms](https://livepolls.com/terms)
* Privacy Policy: [https://livepolls.com/privacy](https://livepolls.com/privacy)

== Branding ==

Free polls may include a small "Powered by LivePolls" badge inside the embedded poll. LivePolls Pro removes the badge.

== Changelog ==

= 1.2.0 =
* New brand identity — gradient emerald block icon and refreshed plugin directory icon
* Color palette adds a Neon (#00E676) preset matching the LivePolls live indicator
* No functional changes; existing posts and shortcodes work unchanged

= 1.1.0 =
* Gutenberg block — search "LivePolls" in the block inserter
* Block accepts a full LivePolls poll URL or just the slug
* Color palette picker for accent color in the block sidebar
* Standard block.json registration with generated WordPress editor assets
* Shortcode still works — backwards compatible

= 1.0.0 =
* Initial release
* Shortcode support with slug and accent color attributes

== Upgrade Notice ==

= 1.2.0 =
Refreshed brand assets (block icon and plugin directory icon) and a new Neon accent preset. No action needed for existing posts.

= 1.1.0 =
Adds a Gutenberg block with a built-in color picker. The shortcode keeps working — no action needed for existing posts.
