-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor plugin to CPT-based architecture with shortcode rendering #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Refactor plugin to CPT-based architecture with shortcode rendering #28
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @NishilHoogar, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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' ); |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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']), |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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"> |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"> |
Copilot
AI
Oct 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"> |