Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

page-block

БесплатноБез исполняемых скриптовНе проверен

Build and push section-based pages using the Marketers Delight Page Block (`marketers-delight/page-block`) Gutenberg block with HTML, CSS, and optional JS in…

wpgauravот wpgaurav★ 24 звезды на GitHub

Об этом скилле

Page Block Skill

Build and push section-based pages using the Marketers Delight Page Block system (v7.0.0). Page Blocks are reusable HTML/CSS/JS/PHP sections stored in a custom database table (wp_md_page_blocks), embeddable via Gutenberg block picker, shortcode, or positioned on hooks site-wide.


What Is a Page Block?

A Page Block is a reusable content unit stored in wp_md_page_blocks with its own HTML, CSS, JS, and display conditions. It can be used in three ways:

  1. Gutenberg block — picked from the library in the Block Editor via marketers-delight/page-block
  2. Shortcode — [page_block id="123"] or [page_block slug="hero-section"]
  3. Positioned — hooked to a theme action (e.g., md_hook_before_header) and conditionally displayed site-wide

Database Schema

Column Type Default Purpose
id bigint AUTO_INCREMENT Primary key
title varchar(255) '' Display name
slug varchar(200) '' Unique identifier
status varchar(20) 'publish' publish/draft/trash
content longtext — HTML (or HTML + PHP)
css longtext — Block CSS
js longtext — Block JavaScript
js_location varchar(10) 'footer' footer or inline
output varchar(10) 'inline' inline or file
php_exec tinyint(1) 0 Execute PHP in content
format tinyint(1) 0 Apply wpautop()
position varchar(100) '' Theme hook name (empty = no auto-placement)
priority int(11) 10 Hook priority
conditions longtext NULL JSON display conditions
author bigint(20) 0 Creator user ID
created_at datetime CURRENT_TIMESTAMP Creation time
updated_at datetime CURRENT_TIMESTAMP Last update time

Gutenberg Block Reference Format

When embedded via the Block Editor, the block comment references by ID:

<!-- wp:marketers-delight/page-block {"blockId":1} /-->

<!-- wp:marketers-delight/page-block {"blockId":50} /-->

Key details:

  • Self-closing block: ends with /--> (no inner blocks)
  • blockId references wp_md_page_blocks.id
  • All content/CSS/JS lives in the database, not in the block comment
  • The block has save: function() { return null; } — all rendering is server-side

Inline Page Block Format

For pages where content/CSS/JS should live directly in the post content (not in the database), use the inline-page-block block type:

<!-- wp:marketers-delight/inline-page-block {"content":"<section>...</section>","css":".class{css:value;}","js":"function (){}"} /-->

Key details:

  • Block name: marketers-delight/inline-page-block (NOT page-block)
  • Self-closing block: ends with /--> (no inner blocks)
  • All content/CSS/JS is JSON-encoded in the block comment attributes
  • content: HTML string (JSON-escaped)
  • css: CSS string (JSON-escaped)
  • js: JavaScript string (JSON-escaped, optional)
  • No blockId — everything is inline in the post content
  • Ideal for programmatic/templated pages (e.g., local SEO city pages) where each page needs unique content
  • Can be mixed with database-backed page-block references on the same page

When to use inline vs database:

  • Database (page-block with blockId): Shared sections reused across many pages (edit once, update everywhere)
  • Inline (inline-page-block): Unique per-page content, programmatic generation, templated pages

Python Pattern for Inline Page Blocks

import json

def inline_page_block(content, css, js=""):
    """Build an inline-page-block comment"""
    obj = {"content": content, "css": css}
    if js:
        obj["js"] = js
    return '<!-- wp:marketers-delight/inline-page-block ' + json.dumps(obj, ensure_ascii=False) + ' /-->'

# Build a page with multiple inline blocks
blocks = [
    inline_page_block('<section class="hero">...</section>', '.hero { background: #000; }', '(function(){})();'),
    inline_page_block('<section class="services">...</section>', '.services { padding: 4rem 0; }'),
]
page_content = "\n\n".join(blocks)

New blocks should use the database blockId reference format for shared content, and inline-page-block for per-page unique content.


How It Renders

CSS Delivery

  1. On template_redirect, positioned blocks are queried and their CSS collected
  2. During the_content, Gutenberg page blocks render and add their CSS
  3. All CSS is combined and output in <head> as <style id="md-page-blocks-css">
  4. File output mode: generates /wp-content/uploads/md-page-blocks/page-blocks-v{version}.css

HTML Rendering

  1. If php_exec is true AND MD_ALLOW_PHP_SNIPPETS is defined truthy in wp-config.php AND the stored php_checksum matches md5($content) at render time, PHP is executed via temp file include. Otherwise <?php … ?> blocks are stripped (HTML between tags is preserved, which is misleading — see "PHP ex
Полный SKILL.md на GitHub

Установить page-block в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл page-block?

Build and push section-based pages using the Marketers Delight Page Block (`marketers-delight/page-block`) Gutenberg block with HTML, CSS, and optional JS in block attributes. Use when creating or updating WordPress pages that use Page Blocks and when generating or pushing Page Block content through the REST API.

Как установить скилл page-block?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл page-block запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить page-block с