Codendesigner
LW Course Catalog - WordPress plugin โ display LearnWorlds courses on any page with a shortcode
LW Course Catalog - WordPress plugin โ display LearnWorlds courses on any page with a shortcode
Couldn't load pickup availability
LW Course Catalog
Display courses from one or two LearnWorlds schools on any WordPress page using a simple shortcode. Visitors browse on WordPress and are redirected to LearnWorlds to enroll and pay.
Installation
lw-course-catalog.zip and click Install Now
Getting your LearnWorlds credentials
All three values you need are on one page inside your LearnWorlds school admin. Navigate to:
https://yourschool.com/author/settings_api
| Value | Where to find it | Notes |
|---|---|---|
| API URL | The "API URL" field with a Copy button | Looks like https://yourschool.com/admin/api/ โ copy it exactly as shown |
| Client ID | Click the eye ๐ icon to reveal, then Copy | Required alongside the Access Token |
| Access Token | Under "Access Tokens" section โ click Create โ eye icon โ copy | Recommended auth method. Long-lived, no expiry unless revoked. |
| Client Secret | Click Copy next to the masked field | Optional โ only needed if not using an Access Token |
/admin/api/). Do not use just the root domain โ the plugin uses the exact URL you provide to build all API calls.www.foodsurety.com), use that custom domain in the API URL โ not the .learnworlds.com subdomain.Plugin settings
Go to Settings โ LW Course Catalog โ โ๏ธ Settings tab. There are two school sections โ School A is required, School B is optional.
| Field | Required | Description |
|---|---|---|
| API URL | Yes | Full API URL from LearnWorlds settings. Example: https://yourschool.com/admin/api/
|
| Access Token โญ | Recommended | Long-lived token. Paste the full string. If provided, Client Secret is not needed. |
| Client ID | Yes | Required alongside Access Token for the Lw-Client request header. |
| Client Secret | Optional | Only used if no Access Token is provided. Plugin falls back to OAuth2 client credentials flow. |
| Field | Default | Description |
|---|---|---|
| Cache Duration | 12 hours | How often course data is re-fetched from LearnWorlds. Options: 1h, 3h, 6h, 12h, 24h. Shorter = fresher data, more API calls. Longer = faster page loads. |
The ๐ Status tab shows the cache state for each school (how many minutes remain before the next auto-refresh), the current configured URLs, and two action buttons:
| Button | What it does |
|---|---|
| Refresh Cache Now | Immediately clears the cache and re-fetches all courses from all configured schools |
| Test Connection & Re-fetch | Same as above but also redirects you to the Debug Log tab to see the full fetch result |
Card design settings
Go to Settings โ LW Course Catalog โ ๐จ Card Design tab. All settings apply globally to every course card on the site.
Toggle the course image on or off
Toggle the excerpt text on or off
Toggle the price badge on or off
Toggle category badges on or off
Links directly to the payment/checkout page
Links to the course detail/landing page
| Setting | Default | Description |
|---|---|---|
| Hide draft courses | On โ | Hides courses with status: draft. Has absolute priority โ a draft course is always hidden when this is on, regardless of the private setting. |
| Hide private courses | On โ | Hides courses with access: private. Only evaluated after the draft check passes. |
| Setting | Default | Description |
|---|---|---|
| Enroll button text | Enroll Now | Label on the primary CTA button. Can also be overridden per-shortcode. |
| Learn More button text | Learn More | Label on the secondary button. Can also be overridden per-shortcode. |
| Description length | 20 words | How many words to show in the course description excerpt (5โ100). |
| Courses per page | 12 | How many cards to show before Prev/Next pagination appears. Can be overridden per-shortcode with the per_page attribute. |
| Setting | Default |
|---|---|
| Card background | #ffffff |
| Enroll button background | #2563eb |
| Enroll button text colour | #ffffff |
| Learn More button background | #f1f5f9 |
| Learn More button text colour | #1e293b |
Draft & private filtering
The plugin uses Option C โ Draft takes absolute priority. A course goes through two gates in strict order. If it is rejected at gate 1 (draft), it never reaches gate 2 (private).
Pagination
On first load the plugin fetches every page of courses from LearnWorlds automatically. LearnWorlds returns 50 courses per API page. For a school with 424 courses this means 9 API requests, all made server-side and cached.
Pagination uses the meta.page and meta.totalPages fields from the LearnWorlds API response. The plugin keeps fetching until page === totalPages.
After all courses are fetched and cached, they are displayed in pages controlled by the Courses per page setting (default: 12). Prev/Next buttons appear automatically below the grid when the total exceeds the per-page limit.
The category filter bar and pagination work together โ filtering resets to page 1 and the page count updates to reflect the filtered total.
| Event | Cache behaviour |
|---|---|
| First page load after activation | Cache is empty โ plugin fetches all courses and stores them |
| Subsequent page loads | Served from cache instantly โ no API calls |
| Cache TTL expires (default 12h) | WP-Cron automatically refreshes in the background |
| Settings saved | Cache is busted immediately โ fresh fetch on next load |
| Card Design settings saved | Cache is busted โ draft/private filter changes take effect |
| Manual Refresh Cache Now | Immediate bust and re-fetch triggered from admin |
Shortcode reference
Place [lw_course_catalog] on any WordPress page, post, or widget area. All attributes are optional โ defaults come from the Card Design settings.
| Attribute | Values | Default | Description |
|---|---|---|---|
| school |
both / a / b
|
both |
Which school's courses to display |
| columns |
1 โ 4
|
3 |
Grid column count. Automatically collapses to 2 on tablet, 1 on mobile. |
| per_page | Any number | From settings | Courses per page before pagination. Overrides the Card Design setting for this instance only. |
| category | Category name | โ | Pre-filter to a single category. Example: category="Food Safety"
|
| enroll_text | Any text | From settings | Override the Enroll button label for this shortcode instance |
| more_text | Any text | From settings | Override the Learn More button label for this shortcode instance |
[lw_course_catalog]
[lw_course_catalog school="a" columns="2"]
[lw_course_catalog category="Food Safety" per_page="6"]
[lw_course_catalog enroll_text="Buy Now" more_text="View Course"]
[lw_course_catalog school="a" columns="3" per_page="9" category="HACCP" enroll_text="Enroll Today"]
| Button | Destination |
|---|---|
| Learn More | The course detail/landing page on LearnWorlds โ e.g. https://yourschool.com/course/intro-haccp
|
| Enroll Now | The payment page on LearnWorlds โ e.g. https://yourschool.com/payment?product_id=intro-haccp&type=course
|
Both buttons open in a new tab. No payment or registration happens on WordPress โ everything is handled by LearnWorlds.
Debug log
Go to Settings โ LW Course Catalog โ ๐ Debug Log tab. The log records every step of the API fetch process โ authentication, pagination, filtering, and caching.
| Level | Colour | What it means |
|---|---|---|
| ERROR | ๐ด Red | Something failed โ authentication error, API error, or network problem. Always investigate these. |
| WARN | ๐ก Yellow | A non-fatal issue โ e.g. School B not configured, or a fallback was used. |
| INFO | ๐ต Blue | Normal progress messages โ token obtained, page fetched, courses cached. |
| DEBUG | โซ Gray | Detailed technical data โ exact URLs called, raw API meta, field names. Useful for diagnosing image or pagination issues. |
| Action | Description |
|---|---|
| Run Connection Test | Clears the cache and triggers a fresh fetch from all configured schools. All steps are logged in real time. Use this after changing credentials. |
| Clear Log | Removes all log entries. The log automatically keeps the most recent 200 entries. |
| Filter buttons | Show only Errors, Warnings, Info, or Debug entries. Useful for quickly spotting problems. |
After a successful connection test you should see entries like this (newest first in the log):
INFO [School A] โ Fetch complete. Total courses: 412 across 9 pages INFO [School A] Page 9 done: 24 items, 4 skipped, has_more=NO, total=412 INFO [School A] Page 8 done: 50 items, 6 skipped, has_more=YES, total=388 ... INFO [School A] Page 1 done: 50 items, 10 skipped, has_more=YES, total=40 INFO [School A] Using static access token INFO [School A] Starting API fetch
Troubleshooting
https://yourschool.com/admin/api/. Do not use the root domain alone. Copy it exactly from LearnWorlds Settings โ Developers โ API.payment_url field directly, the plugin uses that instead.manage_options capability (Administrator role). Lower-level roles cannot save plugin settings.-
100% Satisfaction Unlimited revisions until you're thrilled
-
Fast Turnaround Most projects shipped in 7โ14 days
-
Secure Payment Encrypted checkout & milestone billing
-
Free Consultation 30-min strategy call before you book
- Choosing a selection results in a full page refresh.
- Opens in a new window.