PHPackages                             giantpeach/schnapps - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. giantpeach/schnapps

ActiveProject[Framework](/categories/framework)

giantpeach/schnapps
===================

Peach Schnapps is a WordPress starter theme based on the Roots Bedrock framework.

v1.0.24(1y ago)027MITPHPPHP &gt;=8.0

Since Nov 24Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Giant-Peach-Design/schnapps)[ Packagist](https://packagist.org/packages/giantpeach/schnapps)[ Docs](https://giantpeach.agency)[ RSS](/packages/giantpeach-schnapps/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (34)Versions (32)Used By (0)

Peach Schnapps
==============

[](#peach-schnapps)

[![Schnapps](https://camo.githubusercontent.com/f9e899e57e6cd376c96485d05f013c67919ee78827a9e9ccd3cfb6320b8c4250/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50656163682d5363686e617070732d2532336165613066643f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/f9e899e57e6cd376c96485d05f013c67919ee78827a9e9ccd3cfb6320b8c4250/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50656163682d5363686e617070732d2532336165613066643f7374796c653d666f722d7468652d6261646765)

What is Peach Schnapps
----------------------

[](#what-is-peach-schnapps)

Peach Schnapps is our Wordpress site boilerplate based on the [roots.io](http://roots.io) stack, making use of Bedrock for the site structure and the new WP Block Theme functionality for the theme.

### Stack

[](#stack)

- Lando
- Bedrock
- AlpineJS
- TailwindCSS
- Parcel
- Twig for templating

### Pre-requisites

[](#pre-requisites)

- [Lando](https://lando.dev)
- [Composer](https://getcomposer.org)
- An auth.json file in your home directory with your ACF Pro key in it, see [here](https://www.advancedcustomfields.com/resources/installing-acf-pro-with-composer/) for more info, e.g. `~/.composer/auth.json`

```
{
  "http-basic": {
    "connect.advancedcustomfields.com": {
      "username": "your-key-here",
      "password": "http://wp-playground.lndo.site"
    }
  }
}
```

### Modules

[](#modules)

Peach Schnapps comprises of several different modules, designed to be updated separately to ease future development and support on projects.

These modules are:

- Navigation
    - Simplifies creation and templating of navigation menus within Wordpress, to avoid using `wp_nav_menu()`
- Twiglet
    - Allows use of Twig templates within the theme to make working with Blocks easier
- Images
    - A more flexible way of handling / displaying images. You just output the image at the size you want and it's automatically resized/cropped. Additionally, allows easy conversion to webp. You no longer need to rely on `add_image_size()` . Allows creation of blocks with image sizing fields - maybe you could pick from a pre-set list, or maybe the end user can just enter some numbers, it's ezpz.
- Blocks
    - Simplifies the creation, registration and rendering of Gutenberg blocks
- Query
    - A wrapper around WP\_Query to simplify querying posts
- Route
    - A wrapper around wp\_register\_rest\_route to simplify usage

Theme Folder Structure
----------------------

[](#theme-folder-structure)

```
/
/acf-json
/build
/build/blocks
/dist
/parts
/src
/src/Blocks
/src/Components
/src/fonts
/src/Patterns

```

Blocks
------

[](#blocks)

Blocks in Peach Schnapps are handled by the `giantpeach/blocks` library. This library contains some simple wrappers around block creation / registration / rendering to make life easier, and it allows a mixture of ACF Blocks and those using Wordpress Block API directly.

The following blocks are included:

- Logo
- Banner
- Columns
    - Column
- Image
- Button

### Creating Blocks

[](#creating-blocks)

#### **Easy Way**

[](#easy-way)

There is a `create-block` WP CLI command you can run using `lando wp create-block ` to scaffold a block.

#### **Manual Way**

[](#manual-way)

Additional blocks can easily be created using either ACF Blocks or the Wordpress Block API. The simplest way is to use ACF Blocks, and there's a `BlockInterface` PHP class interface and several examples to help out (e.g. the Banner block).

For any block where you require more control over the markup in the editor you may want to reach for the Wordpress Block API. Blocks created in either way are fully compatible with each other.

All blocks need to be added to the `$blocks` variable in the `Giantpeach\Schnapps\Blocks` class in order to be registered.

##### Creating an ACF Block

[](#creating-an-acf-block)

Additional ACF Blocks can easily be created by creating a new folder within the `src/blocks` folder with a block.json and the PHP class at a minimum.

The block.json should contain the following:

```
{
  "name": "giantpeach/banner",
  "title": "Banner",
  "description": "Banner Block",
  "category": "formatting",
  "icon": "admin-comments",
  "keywords": ["banner"],
  "acf": {
    "mode": "preview",
    "renderCallback": "Giantpeach\\Blocks\\Banner\\Banner::display"
  },
  "align": "full",
  "supports": {
    "jsx": true
  }
}
```

The PHP class needs to implement the BlockInterface, here is a minimal example:

```
