mindtwo / wordpress-flipbook
WordPress plugin that turns PDFs from the media library into self-hosted, accessible page-flip flipbooks, with a block and a shortcode.
Package info
github.com/mindtwo/wordpress-flipbook
Type:wordpress-plugin
pkg:composer/mindtwo/wordpress-flipbook
Requires
- php: ^8.2
- composer/installers: ^1.0|^2.0
- mindtwo/base-flipbook: ^1.0
Requires (Dev)
- brain/monkey: ^2.8
- laravel/pint: ^1.13
- pestphp/pest: ^2.34|^3.0|^4.0
- php-stubs/wordpress-stubs: ^6.5
- phpstan/phpstan: ^1.11|^2.0
- szepeviktor/phpstan-wordpress: ^1.3|^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-01 16:28:13 UTC
README
WordPress plugin that turns PDFs from the media library into self-hosted page-flip flipbooks — a
replacement for Yumpu or Issuu without ads, third-party trackers or a foreign domain. Built on
mindtwo/base-flipbook.
- Block "Flipbook" — choose or upload a PDF, optional title, PDF download on/off.
- Shortcode —
[flipbook id="123"]for the classic editor, page builders, ACF and Timber. - Background conversion — via Action Scheduler (WooCommerce and others ship it) or WP-Cron.
- Replace PDF — box Flipbook on the edit screen of a PDF: upload a new edition under the same ID and URL. Visitors see the previous edition until the new one is complete. The plugin "Enable Media Replace" is supported as well.
- Media → Flipbooks — status, progress, errors, tagged/untagged PDFs, shortcode, regenerate.
- Accessible viewer — keyboard control, live announcements, server-side text version,
optional download,
prefers-reduced-motion; neutral design with a dark variant. - English and German interface.
Installation
Requirements: WordPress 6.5+, PHP 8.2+ with GD, poppler-utils on the server
(sudo apt install poppler-utils). Media → Flipbooks warns when they are missing.
Classic WordPress without Composer (ZIP upload)
Build the ZIP (also attached to every CI run as artifact) and upload it under
Plugins → Add New → Upload Plugin. The ZIP bundles its vendor/ directory, with
mindtwo/base-flipbook from Packagist:
bin/build-zip.sh 1.0.0 # writes dist/wordpress-flipbook-1.0.0.zip
To bundle an unreleased core instead, set BASE_FLIPBOOK_PATH=../base-flipbook.
Composer-based WordPress (Bedrock)
composer require mindtwo/wordpress-flipbook wp plugin activate wordpress-flipbook
The viewer files are copied from the package into wp-content/uploads/flipbook-assets/{version}/
on first use, so they are reachable even when vendor/ lies outside the web root.
Usage
Block: insert Flipbook, choose a PDF, publish. The block supports wide and full alignment and
a margin; an additional CSS class (block settings → Advanced), e.g. mt-flipbook--dark, is set on
the flipbook itself. Shortcode:
[flipbook id="123"]
[flipbook id="123" title="Magazine 02/26" download="0" class="mt-flipbook--dark"]
| Attribute | |
|---|---|
id |
attachment ID of the PDF (shown under Media → Flipbooks) |
title |
shown above the flipbook (default: attachment title) |
download |
1/0, offer the PDF download (default 1, recommended for accessibility) |
class |
additional classes, e.g. mt-flipbook--dark |
hash_key |
deep link prefix when a page has several flipbooks (default seite → #seite-12) |
Styling: override the --mt-flipbook-* custom properties in the theme, see
base-flipbook. Conversion settings can be
changed with a filter:
add_filter('mindtwo_flipbook_options', fn (array $options) => ['widths' => [1000, 2000]] + $options);
Changed settings apply to new conversions; existing flipbooks keep their images until they are regenerated (Media → Flipbooks → Regenerate).
Every uploaded PDF is converted right away. Sites with many PDFs that are never embedded (invoices, data sheets) can convert a PDF only when a page that embeds it is viewed for the first time; the filter receives the attachment ID:
add_filter('mindtwo_flipbook_convert_on_upload', '__return_false');
Notes
-
Pages are stored in
wp-content/uploads/flipbooks/{attachment-id}/{build}/. Every conversion writes a new build; the active one is switched afterwards. The previous build is kept until the next switch, so pages served from a full-page cache keep working; older builds are deleted. Deleting the PDF deletes its flipbook. -
After every switch the action
mindtwo_flipbook_publishedfires with the attachment ID and the build, e.g. to purge the page cache:add_action('mindtwo_flipbook_published', function (int $id, string $build): void { if (function_exists('rocket_clean_domain')) { rocket_clean_domain(); // WP Rocket } }, 10, 2);
-
Conversions run through Action Scheduler when another plugin ships it (WooCommerce and others), otherwise through WP-Cron. Action Scheduler runs one batch at a time by default, so converting a large PDF delays its other jobs (e.g. WooCommerce webhooks) for minutes, and jobs running longer than five minutes may be listed as failed under Tools → Scheduled Actions although they finish. To use WP-Cron instead:
add_filter('mindtwo_flipbook_use_action_scheduler', '__return_false');
-
A conversion takes about 1–2 seconds per page. WP-Cron starts it with the next request to the site, so on sites with little traffic it may start late; a real cron (
DISABLE_WP_CRONpluswp cron event run --due-now) or Action Scheduler makes it reliable. -
Deactivating the plugin cancels pending conversions. Deleting it under Plugins removes the flipbooks, the viewer files and the conversion status; the PDFs stay in the media library.
-
The text version depends on the PDF. Export PDFs as PDF/UA for full accessibility.
-
The PDF stays a regular public file. Disabling the download only hides the link.
Development
composer install
composer check # pint --test, phpstan (level 8), pest
The tests replace WordPress with Brain Monkey and keep post meta in memory; the conversion tests need poppler-utils and are skipped without them.
Standalone, the core mindtwo/base-flipbook comes from Packagist; CI removes the path repository
base-flipbook when ../base-flipbook does not exist. To develop against unreleased core changes,
work in the monorepo mindtwo/flipbook.mindtwo.packages,
where the core resolves through that path repository. Translations: languages/ (PHP .l10n.php for the
server, JSON for the block editor).
License
MIT, see LICENSE.md.