Blockstudio
General

Getting Started

This guide will help you set up Blockstudio and create your first custom block.

Installation

composer require blockstudio/blockstudio

Composer installations receive updates through Composer. The built-in GitHub updater is automatically disabled.

Manual Installation

Download latest release from GitHub

Upload the zip to your WordPress plugins directory and activate the plugin. Manual installations receive automatic update notifications in the WordPress dashboard via the built-in GitHub updater.

Creating Your First Block

1. Create a Block Directory

Create a new directory in your theme:

my-theme/
  blockstudio/
    my-first-block/
      block.json
      index.php

2. Define the Block Schema

Create block.json with your block configuration:

block.json
{
  "$schema": "https://blockstudio.dev/schema/block",
  "name": "my-theme/my-first-block",
  "title": "My First Block",
  "category": "common",
  "icon": "star-filled",
  "blockstudio": {
    "attributes": [
      {
        "id": "heading",
        "type": "text",
        "label": "Heading",
        "default": "Hello World"
      },
      {
        "id": "content",
        "type": "textarea",
        "label": "Content"
      }
    ]
  }
}

3. Create the Template

Create index.php for rendering:

index.php
<div class="my-first-block">
  <h2><?php echo $a['heading']; ?></h2>
  <p><?php echo $a['content']; ?></p>
</div>

Using Twig Templates

Blockstudio supports Twig templates out of the box. Simply use index.twig instead:

index.twig
<div class="my-first-block">
  <h2>{{ a.heading }}</h2>
  <p>{{ a.content }}</p>
</div>

Adding Styles

Create a style.css file in the same folder:

style.css
.my-first-block {
  padding: 2rem;
  background: #f5f5f5;
}

Blockstudio will automatically enqueue this stylesheet when the block is used.

Next Steps

Your block is now ready to use in the WordPress editor. Continue exploring the documentation to learn about:

Guide: Building a Block LibraryGo from a single block to a full library: design tokens, the section pattern, repeaters, images, and page composition.

On this page