WP Manifestindependent plugin directory
manifest / social / tfa-polls

TFA Interactive Polls

WordPress plugin for interactive polls with REST API voting and cookie-based tracking

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/brandonfricke/tfa-polls/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin providing interactive polling functionality with REST API voting, cookie-based vote tracking, and rate limiting.

Features

  • Custom Post Type for polls
  • [tfa_poll] shortcode for embedding polls
  • REST API endpoints for voting
  • Cookie-based vote tracking (30-day expiration)
  • Rate limiting (5 votes per minute per IP)
  • Open/Closed poll status
  • Accessible ARIA markup
  • Dark mode support
  • Mobile-responsive design

Requirements

  • WordPress 6.0+
  • PHP 7.4+

Installation

  1. Download the plugin
  2. Upload to /wp-content/plugins/tfa-polls/
  3. Activate the plugin in WordPress Admin > Plugins
  4. Configure settings in Settings > TFA Polls

Usage

Creating a Poll

  1. Go to Polls > Add New in WordPress Admin
  2. Enter your poll question as the title
  3. Add poll options (minimum 2 required)
  4. Set poll status (Open or Closed)
  5. Publish the poll

Embedding a Poll

Use the shortcode in any post or page:

[tfa_poll id="123"]

Replace 123 with your poll ID (shown in the Poll settings sidebar).

REST API Endpoints

Submit Vote

POST /wp-json/tfa/v1/polls/{id}/vote

Body:

{
  "option": 0
}

Response:

{
  "success": true,
  "voted": 0,
  "results": [
    {"text": "Option A", "votes": 10, "percentage": 50},
    {"text": "Option B", "votes": 10, "percentage": 50}
  ],
  "total_votes": 20
}

Get Results

GET /wp-json/tfa/v1/polls/{id}/results

Response:

{
  "id": 123,
  "question": "Poll Question",
  "status": "open",
  "results": [...],
  "total_votes": 20
}

Configuration

Proxy Headers

If your site is behind a proxy (Cloudflare, Nginx, etc.), add this to wp-config.php for accurate IP-based rate limiting:

define( 'TFA_TRUST_PROXY_HEADERS', true );

Styling

The plugin includes CSS with CSS custom properties that integrate with themes using the following tokens:

  • --color-surface - Background color
  • --color-border - Border color
  • --color-text - Text color
  • --color-primary - Primary accent color (default: #bf5700)
  • --radius-md - Border radius
  • --space-* - Spacing scale

Dark mode is supported via the .tfa-dark-mode body class.

Changelog

1.0.0

  • Initial release
  • Extracted from Texas Football Analytics theme v1.10.0

License

GPL-2.0+