lachlanarthur/sage8-acf-wp-blocks
Composer 安装命令:
composer require lachlanarthur/sage8-acf-wp-blocks
包简介
Create Gutenberg blocks from Sage 8 templates and ACF fields.
README 文档
README
Generate ACF Gutenberg blocks just by adding templates to your Sage 8 theme. This package is forked from the Sage 9 version by MWDelaney which is based heavily on this article by nicoprat.
Installation
Run the following in your Sage 8-based theme directory:
composer require "lachlanarthur/sage8-acf-wp-blocks"
Requirements
- Wordpress 5+
- Advanced Custom Fields 5.8+
- Theme based on Sage 8 (See the original for Sage 9)
Creating blocks
Add templates to your-theme/wp-blocks which get and use ACF data. Each template requires a metadata comment block with some data in it:
<?php /** * Title: * Description: * Category: * Icon: * Keywords: * Post Types: * Default Mode: * Default Alignment: */
Example block template
<?php /** * Title: Testimonial * Description: Customer testimonial * Category: formatting * Icon: admin-comments * Keywords: testimonial quote * Post Types: post page * Default Mode: preview * Default Alignment: full */ ?> <blockquote data-<?= sanitize_html_class( $block['id'] ) ?> class="<?= esc_attr( $block['classes'] ) ?>"> <p><?= get_field('testimonial') ?></p> <cite> <span><?= get_field('author') ?></span> </cite> </blockquote> <style type="text/css"> [data-<?= sanitize_html_class( $block['id'] ) ?>] { background: <?= get_field('background_color') ?>; color: <?= get_field('text_color') ?>; } </style>
Block options
| Option | Value |
|---|---|
| Category | commonformattinglayoutwidgetsembedCreate your own |
| Icon | The name of a Dashicon |
| Post Types | Space-delimited list of post types |
| Default Mode | previewedit |
| Default Alignment | leftcenterrightwidefull |
Creating ACF fields
Once a block is created you'll be able to assign ACF fields to it using the standard Custom Fields interface in WordPress. We recommend using sage-advanced-custom-fields to keep your ACF fields in version control with Sage.
Changing the blocks directory
The wp-blocks directory can be changed with the filter sage8-acf-wp-blocks-paths:
add_filter('sage8-acf-wp-blocks-paths', function ($paths) { return ['templates/blocks', 'another-path']; }, 10, 1);
lachlanarthur/sage8-acf-wp-blocks 适用场景与选型建议
lachlanarthur/sage8-acf-wp-blocks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.02k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「advanced custom fields」 「gutenberg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lachlanarthur/sage8-acf-wp-blocks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lachlanarthur/sage8-acf-wp-blocks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lachlanarthur/sage8-acf-wp-blocks 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Feehi CMS Project Template
Multiauth and custom grants for laravel passport
Advanced taxonomies
Custom SilverStripe tweaks to keep things tidy.
Extends basic Wordpress features.
This extension will allow you to set the default of product custom options for Magento 2
统计信息
- 总下载量: 8.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-18