Kouib Blocks for Tutor LMS
Version 1.0.2
Professional Gutenberg blocks for Tutor LMS courses: filter, carousel, categories, a fast Arabic-tolerant search and platform stats. Compatible with RTL and theme.json.
The five blocks
- Courses Filter — a grid with category buttons, ordering by student count, and a cache per settings combination; works on the frontend and in the editor (live preview).
- Courses Carousel — a responsive slider with side arrows, adjustable columns and multiple orderings.
- Course Category Boxes — a grid of categories with a counter and a link, plus a custom icon (PNG/SVG) per category uploaded from the media library.
- Quick Search — instant (AJAX) results with no page reload, Arabic normalization (أ/إ/آ→ا، ة→ه، ى→ي), smart relevance ranking, a "match exact phrase" option, and adjustable colors/size.
- Platform Stats — prominent counters (icon + number + label) for students, instructors, courses and lessons in a responsive grid.
Guaranteed performance
- Transient cache for every piece with an active-keys registry flushed automatically on: saving/deleting a course, a new enrollment (tutor_after_*), or a plugin update.
- Light queries: students = total WordPress user count; instructors = a single DISTINCT query.
- Each block's assets load only when the block is present — no extra CSS/JS.
Installation
- Upload the folder to
wp-content/plugins/ or install the zip from "Plugins → Add New → Upload Plugin".
- Activate the plugin, then activate Tutor LMS to provide the courses.
- In the editor, add any block from the Kouib Blocks category at the top of the block inserter.
Frequently Asked Questions
- Does it work without Tutor LMS? Yes, blocks activate and register, but zero courses/lessons appear because the content types belong to Tutor.
- Does it affect speed? No — a cache per block and a 30-minute TTL adjustable via the filter:
kouib_cache_ttl.
- Is programmatic customization available? Yes:
kouib_cache_ttl, kouib_register_active_key, kouib_flush_courses_cache.
- Does it work with any theme? It respects
theme.json (block supports, generated CSS variables via wp_get_global_settings) and is tested with RTL.
Source Code
The source code for this plugin is publicly available at: https://github.com/kouiderbounama/kouib-blocks-for-tutor-lms
The source code for the compiled block editor scripts is also included in the src/ directory of this plugin. Each block's edit.jsx file is the human-readable source that generates the corresponding build/*/index.js file.
To regenerate the compiled files:
- Install Node.js 18+ and run
npm install in the plugin root.
- Run
npx wp-scripts build to compile src/ into build/.
- Run
node build-i18n.js to regenerate translation files.
The vanilla JavaScript files in assets/js/ (carousel.js, search.js, view.js) are hand-written source files and are not generated by build tools.
Changelog (recent)
- 1.0.2 — Fixed a paid course showing the "Free" badge when its price was missing in Tutor; badge text and color now share one source (the price type). The currency symbol now appears after the price, the sale price is used when lower than the regular one, and the linked WooCommerce product price is used as a fallback.
- 1.0.1 — Carousel: fixed flipped navigation arrows in RTL (logical inset-inline positions) and frontend assets now load before the cache lookup, keeping full styling on cached loads. Cache keys unified under the kouib_ prefix. ZIP rebuilt with forward-slash paths.
- Initial release — five blocks for Tutor LMS: Courses Filter, Courses Carousel, Course Category Boxes, Quick Search and Platform Stats. Transient cache with automatic invalidation and selective asset loading. Central settings panel, full RTL support, Arabic-tolerant search and a bundled Arabic translation. Clean uninstall.