wrd/wp-blocks 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wrd/wp-blocks

最新稳定版本:1.3.6

Composer 安装命令:

composer require wrd/wp-blocks

包简介

Simplifies the process for WordPress themes to create and write ACF Pro Blocks.

README 文档

README

Automatically creates blocks from the theme's blocks directory.

Usage

Use register_all_theme_blocks to register all blocks in the the themes' block directory. This defaults to blocks/.

You can use the wrd\wp-blocks\get_theme_blocks_dir filter to change the location of the theme's blocks dir.

Commands

You can use the following command to quickly generate a block, with optional ACF, CSS and JS files.

./vendor/bin/blocks --help

Registration

register_all_theme_blocks

Registers all blocks in the theme's block directory.

register_theme_block

Registers an individual block. Blocks are defined as a directory with a block.json file. Will also import an Advanced Custom Fields JSON file with the name acf.json if it exists.

register_block_category

Register a new block category.

set_include_theme_block_styles_before_render

Force WordPress to include block styles individually, with the block when it is rendered.

set_allowed_block_types

Whitelists the allowed blocks. Optionally whitelists a post type which is given a higher precedence.

set_use_block_editor

Enables or disables the block editor. Optionally takes a post type which is given a higher precedence.

set_use_inner_blocks_wrapper

Enable to disable the wrapper around inner blocks. Only works on the front-end.

set_use_core_styles

Used to dequeue the core block styles & global styles.

Templating Functions

block_atts

Output the block's attributes. You can pass attributes of your own to be merged in.

block_is_editor

Checks if the block is currently being rendered for preview in the block editor.

block_has_style

Check if the block has a style selected.

get_block_directory

Get the absolute filepath for the block's directory, with an optional append.

get_block_directory_uri

Get the URL for the block's directory, with an optional append.

get_prose_blocks

Prose blocks are a set of blocks that are typically allowed as text content.

the_inner_blocks

Display a slot for the user to add child blocks.

the_bg_image

Display a style attribute for a background image.

the_link

Easily display an ACF link field.

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-09