
外掛標籤
開發者團隊
② 後台搜尋「OnceBlock – Build Once, Insert Anywhere」→ 直接安裝(推薦)
原文外掛簡介
OnceBlock is a comprehensive solution for managing reusable block content in WordPress. This plugin allows you to create, organize, and deploy block presets across your website with ease.
Key Features
Native WordPress: Works with pure WordPress – no external dependencies required
Custom Post Type: Dedicated “Block Presets” post type for managing reusable content
Gutenberg Ready: Full integration with the native WordPress block editor
Usage Tracking: Monitor which presets are used where and how often
REST API: Full REST API support for headless implementations
Shortcode Support: Easy insertion via shortcodes [bpmgr_block id="123"]
Statistics Dashboard: Comprehensive usage analytics and reporting
Taxonomies: Organize presets with categories and tags
ACF Integration (Optional): Automatic registration of ACF blocks from theme folders if ACF Pro is installed
Developer Friendly: Extensive hooks and filters for customization
Perfect For
Agencies managing multiple client sites
Developers building custom themes with reusable components
Content managers who need consistent design elements
Sites with complex layouts that need to be replicated
Teams collaborating on content creation
Usage Examples
In PHP templates: bpmgr_render_block_preset(123);
In content: [bpmgr_block id="123"]
REST API: GET /wp-json/bpmgr/v1/block-presets, GET /wp-json/bpmgr/v1/block-presets/123, GET /wp-json/bpmgr/v1/block-presets/123/render
ACF Integration
The plugin automatically scans specified theme folders for ACF blocks and registers them in the Gutenberg editor. Default folders include:
general/acf-blocks/
public/acf-blocks/
login-register/acf-blocks/
members/acf-blocks/
You can customize these folders in the plugin settings.
Developer Information
Hooks and Filters
The plugin provides numerous hooks for customization:
Filters:
– bpmgr_block_preset_content – Filter block preset output
REST API Endpoints
GET /wp-json/bpmgr/v1/block-presets – List all presets
GET /wp-json/bpmgr/v1/block-presets/{id} – Get specific preset
GET /wp-json/bpmgr/v1/block-presets/{id}/render – Get rendered preset
File Structure
onceblock/
├── onceblock.php
├── uninstall.php
├── readme.txt
├── LICENSE
├── languages/
│ └── index.php
├── assets/
│ └── js/
│ └── block-preset.js
├── includes/
│ ├── class-bpmgr-post-types.php
│ ├── class-bpmgr-acf-blocks.php
│ ├── class-bpmgr-gutenberg-blocks.php
│ ├── class-bpmgr-helper-functions.php
│ └── class-bpmgr-admin.php
└── admin/
├── settings-page.php
├── tools-page.php
├── statistics-page.php
├── css/
│ └── admin.css
└── js/
├── admin.js
└── statistics-chart.js
For more information and documentation, visit: https://neodavet.github.io/davetportfolio/
