humanmade / post-template-table
A post template like block to output posts as a table
Package info
github.com/humanmade/post-template-table
Language:JavaScript
Type:wordpress-plugin
pkg:composer/humanmade/post-template-table
Requires
- composer/installers: ^1 || ^2
Requires (Dev)
This package is auto-updated.
Last update: 2026-07-02 19:29:33 UTC
README
A WordPress block plugin that provides a table-based alternative to the core/post-template block for displaying query results.
Features
- Table Layout: Display query loop posts in a structured table format
- Sortable Columns: Reorder columns using up/down arrows in the sidebar
- Editable Headers: Customize column header labels
- Toggle Headers: Option to show/hide the header row
- Core Block Support: Works with standard WordPress post blocks:
core/post-titlecore/post-datecore/post-excerptcore/post-featured-imagecore/post-termscore/post-authorcore/post-author-namecore/post-author-biographycore/avatar
Installation
- Copy this plugin folder to your WordPress
wp-content/plugins/directory - Navigate to the plugin directory:
cd wp-content/plugins/hm-post-template-table - Install dependencies:
npm install - Build the plugin:
npm run build - Activate the plugin in WordPress admin
Usage
- Add a Query Loop block to your page/post
- Inside the Query Loop, add the Post Template Table block
- Add post blocks (e.g., Post Title, Post Date) as children to create columns
- Customize column headers in the block sidebar
- Reorder columns using the up/down arrows
- Toggle the header row visibility if needed
Development
Build Commands
npm run start- Start development mode with hot reloadnpm run build- Build production-ready assetsnpm run lint:js- Lint JavaScript filesnpm run lint:css- Lint CSS/SCSS filesnpm run format- Format code using WordPress standards
Block Structure
The block must be used as a child of core/query (Query Loop block). It renders a table where:
- Each inner block becomes a column
- Each post in the query becomes a row
- Headers are customizable via block attributes
Requirements
- WordPress 6.0 or higher
- PHP 7.4 or higher
- Node.js for development
Local Environment
This project uses wp-env to run a lightweight, containerized WordPress instance at localhost:3004 for testing purposes. The default username for the localhost environment is admin, with the password password.
These commands can be used to interact with the environment:
| Command | Purpose |
|---|---|
npm run env:start |
Start the local environment at http://localhost:3004 |
npm run env:stop |
Turn off the local environment |
npm run env:cli -- wp ... |
Run WP-CLI commands within the environment |
npm run env:logs |
Open (and tail) the error logs for the application‡ |
npm run env:db |
Open the database in the mysql command line |
npm run env:destroy |
Fully destroy the local environment (deletes container database) |
‡ This command deliberately filters out GET/OPTIONS/HEAD/POST/PUT access log entries
Release Process
Merges to main automatically build to the release branch. A project may track the release branch using Composer to pull in the latest built beta version.
Commits on the release branch may be tagged for installation via Packagist and marked as releases in GitHub for manual download, using a manually-dispatched "Tag and Release" GH Actions workflow.
To tag a new release:
- Choose the target version number using semantic versioning.
- Check out a
prepare-v#.#.#branch and bump theVersionin the plugin.php PHPDoc header. - Open a pull request titled "Prepare release v#.#.#".
- Review and merge the "Prepare release" pull request.
- Wait for the
releasebranch to update with the build that includes the new version number. - On the "Tag and Release" GH Action page:
- Click "Run workflow" in the
workflow_dispatchbanner. - Fill out the "Version tag" field with your target version number. This must match the
Versioninplugin.php. Use the formatv#.#.#. - Click "Run workflow" to apply the specified tag to the
releasebranch.
- Click "Run workflow" in the
Once the workflow completes, the new version is tagged and listed in releases. Edit the release notes as needed to clarify changes.
License
GPL-2.0-or-later