WP Manifestindependent plugin directory
manifest / events / sw-events

SW - Events CPT

Custom Post Type "Events" with logo, background color, background image, WPForms integration and optional WPGraphQL support.

by Seniors · github.com/dazza-dev/sw-events · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dazza-dev/sw-events/archive/refs/heads/main.zip

Readme

=== SW - Events CPT === Contributors: seniorswp, dazzadev Tags: custom-post-type, events, graphql, wpforms, headless Requires at least: 5.8 Tested up to: 6.8 Requires PHP: 7.4 Stable tag: 1.0.0 License: GPL v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html

Custom Post Type for Events with branding, registration forms and headless frontend support.

== Description ==

Adds an Events Custom Post Type designed for headless WordPress setups. Each event supports full visual branding and a registration form powered by WPForms.

Custom Fields:

  • Description
  • Event date
  • Registration deadline
  • Location
  • Logo (media uploader)
  • Background color (color picker)
  • Background image (media uploader)
  • WPForms form selector
  • Confirmation message (shown after successful registration)
  • Font (Google Fonts or self-hosted)

Integrations:

  • WPGraphQL – Exposes all event fields including parsed WPForms form structure via the swEvents / swEvent queries.
  • WPForms – Reads form field definitions (type, label, required, placeholder, choices) and exposes them via GraphQL for native frontend rendering.
  • REST APIPOST /wp-json/sw-events/v1/submit-form endpoint for headless form submissions with validation, email notification, and WPForms Pro entry storage.

== Installation ==

  1. Upload the sw-events folder to /wp-content/plugins/.
  2. Activate the plugin through the "Plugins" menu in WordPress.
  3. Go to Settings > Permalinks and click "Save" to flush rewrite rules.

== Frequently Asked Questions ==

= Do I need WPGraphQL? =

No. The plugin works with WordPress REST API by default. WPGraphQL support is automatically enabled when the WPGraphQL plugin is active.

= Do I need WPForms? =

WPForms is optional. If installed, you can select a form for each event. The plugin reads the form structure and exposes fields via GraphQL so your headless frontend can render the form natively.

= How do I access events via API? =

REST API: /wp-json/wp/v2/event GraphQL: swEvents / swEvent queries (requires WPGraphQL plugin)

= How does form submission work? =

Your frontend sends a POST request to /wp-json/sw-events/v1/submit-form with:

{ "form_id": 123, "fields": { "0": "John", "1": "john@example.com" } }

The endpoint validates required fields, sends an email notification via wp_mail(), and saves an entry via the WPForms Pro API if available.

= How do fonts work? =

Each event has a font source (Google Fonts or self-hosted) and a font family name. Your frontend uses this to load the appropriate font. Google Fonts are loaded via their CDN; self-hosted fonts must be registered in your frontend CSS.

= What GraphQL fields are available? =

swEvent(id: "slug", idType: SLUG) { title slug swEventFields { description eventDate registrationDeadline location logoUrl bgColor bgImageUrl wpformId confirmationMessage fontSource fontName formFields { id type label required placeholder choices { label value } } } }

== Changelog ==

= 1.0.0 =

  • Initial release
  • Custom Post Type: Events
  • Custom fields: description, event date, registration deadline, location, logo, background color, background image, WPForms selector, confirmation message, font
  • WPGraphQL support with form fields parsing
  • REST API form submission endpoint with validation and email notification
  • CORS support for headless frontends
  • Admin columns: event date, location, logo, background color, form

Read the full README on GitHub →