定制 roots/acorn-fse-helper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

roots/acorn-fse-helper

最新稳定版本:v1.0.3

Composer 安装命令:

composer require roots/acorn-fse-helper

包简介

Bootstrap FSE support in Acorn-based WordPress themes.

README 文档

README

Latest Stable Version Total Downloads Build Status

Acorn FSE Helper provides an easy way to initialize and work with block templates in themes powered by Acorn.

Requirements

Installation

Install via Composer:

$ composer require roots/acorn-fse-helper

Getting Started

Once installed, begin by initializing full-site editing in your theme using Acorn's CLI:

$ wp acorn fse:init

Initializing ensures your current activated theme supports block-templates as well as provides you with the option to publish initial stubs to get started with.

Usage

Once initialized, any block templates located in templates/ will be given priority over existing Blade views.

Blade Directives

To assist with hybrid theme development, Acorn FSE Helper includes a few useful Blade directives out of the box for working with blocks inside of views.

@blocks

The @blocks directive allows you to render raw block markup inside of a view using do_blocks():

@blocks
  <!-- wp:paragraph {"align":"center"} -->
  <p>Lorem ipsum...</p>
  <!-- /wp:paragraph -->
@endblocks

@blockpart

The @blockpart directive provides a convenient way to render block template parts inside of your views using block_template_part():

@blockpart('header')

To render multiple template parts at once, you may pass an array in the order you wish them to be rendered in:

@blockpart(['header', 'footer'])

Vite Asset Integration

Acorn FSE Helper can automatically inject Vite assets (CSS and JavaScript) into the <head> of your FSE theme.

To enable this feature:

  1. Publish the configuration file:

    $ wp acorn vendor:publish --tag=fse-config
  2. Enable Vite asset injection in config/fse.php:

    'vite_enabled' => true,

By default, it includes:

  • resources/css/app.css
  • resources/js/app.js

You can customize the entry points using the acorn/fse/vite_entrypoints filter:

add_filter('acorn/fse/vite_entrypoints', function ($entryPoints) {
    return [
        'resources/css/app.css',
        'resources/css/editor.css',
        'resources/js/app.js',
        'resources/js/custom.js',
    ];
});

Bug Reports

If you discover a bug in Acorn FSE Helper, please open an issue.

Contributing

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

License

Acorn FSE Helper is provided under the MIT License.

统计信息

  • 总下载量: 20.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固