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/henkeinfo/kurso-wordpress/archive/refs/heads/main.zipWordPress plugin for integrating the KURSO course management system via GraphQL API.
Features
- GraphQL integration – Connects WordPress to any KURSO instance via
https://<systemname>.kurso.de/api/graphql - Flexible query configuration – Define any GraphQL queries; each instance has its own data structure
- Twig templating – Full arithmetic, comparisons and loops in templates (e.g. calculate free spots)
- Automatic caching – WP-Cron fetches data at the configured interval and stores results in the WordPress Transient API
- Gutenberg block – With live preview and "Show raw data" toggle
- Shortcode – Classic embed via
[kurso query="..."]
Requirements
- WordPress ≥ 6.0
- PHP ≥ 8.0
- Composer (for development)
Installation
From ZIP
- Download the ZIP file from Releases
- In WordPress: Plugins → Add New Plugin → Upload Plugin
- Activate the plugin
From Source
git clone https://github.com/henkeinfo/kurso-wordpress.git
cd kurso-wordpress
composer install --no-dev --optimize-autoloader
Then copy the folder to wp-content/plugins/kurso-wordpress/ and activate it in WordPress.
Configuration
After activation, go to Settings → KURSO:
| Setting | Description |
|---|---|
| GraphQL URL | https://<systemname>.kurso.de/api/graphql |
| Username | KURSO username |
| Password | KURSO password |
Use "Test Connection" to verify the API connection.
Queries
Under the Queries tab you can add multiple GraphQL queries:
- Slug – Unique identifier used in the shortcode
- GraphQL Query – Full query text
- Polling interval – Fetch frequency in minutes
- Twig Template – HTML template with Twig syntax
Example Query
query {
allCourses(orderBy: startDate_ASC, first: 20) {
name
startDate
endDate
location { name town }
maxPart
_bookingsMeta { count }
onlineEnrollmentUrl
}
}
Example Template (Table)
<table class="kurso-table">
<thead>
<tr><th>Course</th><th>Date</th><th>Location</th><th>Spots</th><th></th></tr>
</thead>
<tbody>
{% for course in allCourses %}
{% set free = course.maxPart - course._bookingsMeta.count %}
<tr>
<td>{{ course.name }}</td>
<td>{{ course.startDate|date("d.m.Y") }}</td>
<td>{{ course.location.town }}</td>
<td>{{ free > 0 ? free : "Fully booked" }}</td>
<td>
{% if free > 0 and course.onlineEnrollmentUrl %}
<a href="{{ course.onlineEnrollmentUrl }}" class="kurso-button">Book now</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
Important: Template variables exactly match the field names from the GraphQL query. The plugin makes no assumptions about data structure — query and template are configured together.
Usage
Shortcode
[kurso query="my-query"]
[kurso query="my-query" class="my-css-class"]
Gutenberg Block
Drag the "KURSO Display" block from the Embeds category into the editor. Select query and template in the sidebar.
Page Builders
The shortcode works in all common page builders — no extra configuration needed. Copy the shortcode for each query via the Copy button under Settings → KURSO → Queries.
- Elementor (including Free): Add a Shortcode widget and paste
[kurso query="my-query"]. - WPBakery: Add a Text Block element and paste the shortcode.
- BeBuilder (BeTheme): Add a Plain text item (Section → Wrap → + Item → Plain text) and paste the shortcode. Do not use the Code item — it displays shortcodes as text instead of executing them.
Twig Syntax Quick Reference
| Expression | Meaning |
|---|---|
{{ variable }} |
Output value |
{{ object.field }} |
Nested value |
{% for item in list %}...{% endfor %} |
Loop |
{% if condition %}...{% endif %} |
Condition |
{{ a - b }} |
Arithmetic |
{{ value\|date("d.m.Y") }} |
Date format |
{{ value\|default("–") }} |
Fallback |
Project Structure
kurso-wordpress/
├── kurso-wordpress.php # Plugin main file
├── admin/
│ └── class-kurso-admin.php # Admin UI
├── includes/
│ ├── class-kurso-settings.php # Settings management
│ ├── class-kurso-graphql.php # GraphQL client
│ ├── class-kurso-cron.php # WP-Cron / polling
│ ├── class-kurso-renderer.php # Twig rendering
│ ├── class-kurso-shortcode.php # Shortcode [kurso]
│ └── class-kurso-block.php # Gutenberg block
├── assets/
│ ├── css/
│ │ ├── kurso-admin.css
│ │ └── kurso-frontend.css
│ └── js/
│ ├── kurso-admin.js
│ └── block.js
├── composer.json
└── vendor/ # Twig (not in Git)
License
MIT – see LICENSE