Course Sync Dashboard
A WordPress plugin that synchronizes external course data from a REST API into a custom post type.
by Marcelo Takano · github.com/marcelo-takano/course-sync-dashboard · website
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/marcelo-takano/course-sync-dashboard/archive/refs/heads/main.zipReadme
Course Sync Dashboard
A WordPress plugin that synchronizes external course data from a REST API into a custom post type and provides a frontend course listing via shortcode.
This project was developed as part of a technical assessment, following WordPress best practices with a focus on clean architecture, maintainability, and separation of responsibilities.
Features
- Custom Post Type: Course
- Admin dashboard
- Synchronize courses from an external REST API
- Create and update existing courses
- Store external course metadata
- Frontend course listing via shortcode
- Responsive frontend layout
- WordPress Coding Standards
- Secure admin actions with capability and nonce validation
External API
The plugin consumes data from:
https://jsonplaceholder.typicode.com/posts
Mapping:
| API Field | WordPress |
|---|---|
| title | Course Title |
| body | Course Description |
| id | External Course ID |
| userId | Stored as metadata |
Installation
- Upload the plugin to:
wp-content/plugins/
-
Activate the plugin.
-
Access:
Dashboard → Course Sync
-
Click Sync Courses.
-
Create a page and insert:
[courses_list]
Frontend
The shortcode displays all synchronized courses.
[courses_list]
Each course includes:
- External Course ID
- Course title
- Course excerpt
- Link to the single course page
Project Structure
course-sync-dashboard/
assets/
css/
courses-list.css
includes/
class-csd-admin.php
class-csd-api.php
class-csd-action.php
class-csd-course-post-type.php
class-csd-shortcode.php
class-csd-sync.php
templates/
courses-list.php
course-sync-dashboard.php
Architecture
The plugin follows a modular architecture where each class has a single responsibility.
CSD_Course_Post_Type
Registers the custom post type.
CSD_API
Handles communication with the external REST API.
CSD_Sync
Processes synchronization and creates or updates WordPress posts.
CSD_Action
Handles admin actions securely.
CSD_Admin
Builds the administration interface.
CSD_Shortcode
Registers and renders the frontend shortcode.
Technical Decisions
Some implementation decisions were made to improve maintainability and performance:
- Single Responsibility Principle
- WordPress native APIs
- Nonce validation
- Capability validation
- Rewrite rules flushed only once after activation
- CSS loaded only when the shortcode is used
- Template separated from business logic
- Efficient course lookup using an external ID map
- Output escaping following WordPress standards
Future Improvements
Possible future enhancements include:
- Scheduled synchronization (WP-Cron)
- Incremental synchronization
- Search and filtering
- Pagination
- Gutenberg block
- Settings page for API endpoint
- Internationalization files
- WP-CLI command support
Requirements
- WordPress 6.x+
- PHP 8.x
Author
Marcelo Takano
Web Developer & Web Specialist
Brazil