hirasso / rh-free-layouts
Free drag-and-drop layouts for ACF Flexible Content and Repeater fields
Package info
github.com/hirasso/rh-free-layouts
Type:wordpress-plugin
pkg:composer/hirasso/rh-free-layouts
Fund package maintenance!
Requires
- php: >=7.4
- composer/installers: ^1.0 || ^2.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Free drag-and-drop layouts for ACF Flexible Content and Repeater fields.
Installation
Via Composer (recommended)
composer require hirasso/rh-free-layouts
Update via Composer
# latest version, including major version jumps
composer require hirasso/rh-free-layouts
Via WP CLI
wp plugin install https://github.com/hirasso/rh-free-layouts/releases/latest/download/rh-free-layouts.zip
Update via WP CLI
wp plugin update rh-free-layouts
Manually
- Download the bundled zip file from the latest release
- In your browser, login to your WP Admin Area and navigate to /wp-admin/plugin-install.php
- Click "Upload Plugin" and choose
rh-free-layouts.zipthat you just downloaded
Update Manually
If DISALLOW_FILE_MODS is not set to true, you can update the plugin directly from the WordPress admin plugins screen, just like any other plugin. To avoid being blocked by GitHub, you can define a RHFL_GITHUB_TOKEN in your wp-config.php file. Learn more about creating GitHub Tokens
// wp-config.php: define('RHFL_GITHUB_TOKEN', 'qwf_sdgad142...');
How to use
- Activate the plugin
- Add a field with type
Free Layoutto your ACFFlexible ContentorRepeater. - Optionally add a field with type
Reset Free Layoutsto your post
Wrap your module or repeater row like this:
<?php ob_start(); ?> <div class="my-module">This module will support free layout</div> <?php echo function_exists('rhfl') ? rhfl()->wrap_item( $value, ob_get_clean() ) : ob_get_clean() ?>
Initiate the edit mode from your php template (after all items have been rendered):
if( function_exists('rhfl') ) rhfl()->get_edit_mode_js();
For full control over context and options, you can also initiate RHFL using JavaScript:
if (window.RHFL != null) { window.RHFL.initEditMode({ containerElement: document.querySelector('.my-free-layout'), groupSelector: '.my-group' }); }
Development
Requires Node >= 22 and pnpm. ACF (Pro, for Flexible Content / Repeater) must be active on the site.
pnpm install # also points git to .githooks/ pnpm watch # dev build with live reload; production build on exit pnpm build # production build into assets/
- Sources live in
assets-src/(rh-free-layouts.js,scss/), built bybuild.mjs(esbuild + dart-sass + postcss-preset-env) intoassets/ assets/is committed: the plugin is installed straight from the repo without building. The pre-commit hook rebuilds and stages it; CI (.github/workflows/assets.yml) fails if it doesn't match a fresh build
plugin-update-checker
Updates are served from GitHub releases via plugin-update-checker, bundled as an unmodified copy in lib/plugin-update-checker/. To update it, replace the folder with the new release and adjust the versioned v5pN import in inc/class.update-checker.php.
Release
./release.sh <patch|minor|major>
Bumps the version in rh-free-layouts.php, prepends a changelog.md section from the commits since the last tag, builds, commits, tags, pushes and creates a GitHub release with a zip (requires gh). Files with export-ignore in .gitattributes are left out of the zip.