Refactor plugin to CPT-based architecture with shortcode rendering#28
Refactor plugin to CPT-based architecture with shortcode rendering#28NishilHoogar wants to merge 2 commits intofossasia:mainfrom
Conversation
NishilHoogar
commented
Oct 23, 2025
- Replaced JSON file system with WordPress Custom Post Types (events, speakers)
- Added CPT registration in includes/class-wpfa-cpt.php
- Implemented [wpfa_speakers] shortcode via WP_Query
- Added default stylesheet in public/css/wpfa-public.css
- Updated WP-CLI seeder for CPT data
- Removed legacy JSON-based templates and logic
- Simplified uninstaller and standardized structure
- Replaced JSON file system with WordPress Custom Post Types (events, speakers) - Added CPT registration in includes/class-wpfa-cpt.php - Implemented [wpfa_speakers] shortcode via WP_Query - Added default stylesheet in public/css/wpfa-public.css - Updated WP-CLI seeder for CPT data - Removed legacy JSON-based templates and logic - Simplified uninstaller and standardized structure
There was a problem hiding this comment.
Sorry @NishilHoogar, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the plugin from a JSON file-based system to a WordPress Custom Post Type (CPT) architecture for managing events and speakers. The major changes include adding CPT registration for events and speakers, implementing a [wpfa_speakers] shortcode, adding a WP-CLI seeder for development data, including default public styles, and updating the uninstaller to handle CPT cleanup.
Reviewed Changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| uninstall.php | Contains merge conflict markers that need resolution |
| templates/*.php | Legacy template files still rely on JSON file system; not yet migrated to CPT queries |
| public/wpfa-public.css | Adds new default styles for speaker archive display |
| public/class-wpfa-public.php | Implements shortcode rendering with WP_Query for speakers CPT |
| includes/class-wpfa-cpt.php | Registers wpfa_event and wpfa_speaker CPTs with meta fields |
| includes/class-wpfa-cli.php | Provides WP-CLI seeder for CPT data from JSON or minimal fixtures |
| includes/class-fossasia-uninstaller.php | New uninstaller class for CPT cleanup |
| fossasia-landing.php | Main plugin file updated to initialize CPT and public handlers |
| templates/minimal.json | Sample JSON fixture for seeding test data |
| README.md | Contains merge conflict markers that need resolution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
uninstall.php
Outdated
| <<<<<<< Updated upstream | ||
|
|
||
| /** | ||
| * Fired when the plugin is uninstalled. |
There was a problem hiding this comment.
Merge conflict markers are present in the file. These must be resolved before merging. Remove the conflict markers (<<<<<<< Updated upstream, =======, >>>>>>> Stashed changes) and retain only the correct code.
| @@ -1,3 +1,4 @@ | |||
| <<<<<<< Updated upstream | |||
There was a problem hiding this comment.
Merge conflict markers are present in the file. These must be resolved before merging. Remove the conflict markers and consolidate both versions of the README into a single coherent document.
| <<<<<<< Updated upstream |
public/class-wpfa-public.php
Outdated
| @@ -0,0 +1,96 @@ | |||
| n<?php | |||
There was a problem hiding this comment.
There is an extraneous 'n' character before the PHP opening tag. This will cause a PHP parse error. Remove the 'n' character so the file starts with '<?php'.
| n<?php | |
| <?php |
| * Register the stylesheets for the public-facing side of the site. | ||
| */ | ||
| public function enqueue_styles() { | ||
| wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpfa-public.css', array(), $this->version, 'all' ); |
There was a problem hiding this comment.
The CSS path uses 'css/wpfa-public.css' but the actual file is at 'wpfa-public.css' (no 'css/' subdirectory based on the diff). This will result in a 404 error. Correct the path to 'wpfa-public.css'.
| wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpfa-public.css', array(), $this->version, 'all' ); | |
| wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'wpfa-public.css', array(), $this->version, 'all' ); |
includes/class-wpfa-cli.php
Outdated
| foreach ( $speakers as $s ) { | ||
| $speaker_ids[] = self::upsert_post_by_slug( | ||
| 'wpfa_speaker', | ||
| sanitize_title($s['slug']), |
There was a problem hiding this comment.
[nitpick] Function calls should be followed by a space before the opening parenthesis for consistency with WordPress coding standards. Change sanitize_title($s['slug']) to sanitize_title( $s['slug'] ).
templates/code-of-conduct-page.php
Outdated
| <header class="nav" role="banner"> | ||
| <div class="container nav-inner"> | ||
| <a href="<?php echo esc_url( home_url( '/events/' ) ); ?>"> | ||
| <img src="<?php echo plugins_url( '../images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> |
There was a problem hiding this comment.
The image path uses '../images/logo.png' but based on other templates in the diff, the correct path should be '../assets/images/logo.png'. This will result in a broken image link.
| <img src="<?php echo plugins_url( '../images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> | |
| <img src="<?php echo plugins_url( '../assets/images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> |
templates/past-events-page.php
Outdated
| <header class="nav" role="banner"> | ||
| <div class="container nav-inner"> | ||
| <a href="<?php echo esc_url( home_url( '/events/' ) ); ?>"> | ||
| <img src="<?php echo plugins_url( '../images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> |
There was a problem hiding this comment.
The image path uses '../images/logo.png' but should be '../assets/images/logo.png' based on other template files. This will result in a broken image link.
| <img src="<?php echo plugins_url( '../images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> | |
| <img src="<?php echo plugins_url( '../assets/images/logo.png', __FILE__ ); ?>" alt="Logo" class="site-logo"> |