Stable tag: 0.3.26 Tested up to: 6.5.3 Requires at least: 6.3 Requires PHP: 8.1 License: GPL-3.0+ Tags: Label, print, print.css, block Contributors: carstenbach
Gutenberg is famous for printing, so let's print multiple identical labels on paper. Using blocks.
The Label Printing block plugin is made to help you print multiple identical labels on paper easily. This plugin is ideal for various use cases, such as creating labels for posters, flyers, or any other printed materials. Whether you're managing a theater production or prepare & organize the next local WordCamp, this plugin can help streamline the process for any project that requires physical, printed labels.
The plugin allows you to configure a set of labels, probably identical to the paper-labels in your desk. After you prepared at least one label you are ready to print.
For now (#5) this step has no UI, so you have to rely on the default label sizes provided by this plugin or add you own via the Figuren_Theater\Label_Printing\Patterns\bootstrap_labels
filter.
A label - within this plugin - consists of a human readable title and the physical measurements of a normal printing-label. In other words, width, height and orientation of the label are saved, as well as the borders on an A4 sheet, if any.
The Label Printing plugin provides one filter to customize default Labels, that will be created if none exist. Add your own labels or adjust the defaults using this filter.
/**
* Add your own labels or adjust the defaults using this filter.
*
* @hook Figuren_Theater\Label_Printing\Patterns\bootstrap_labels
* @since 0.2.0
*
* @param {array} $default_labels List of Labels (an array of arrays) that will be inserted into the DB on import by default.
*
* @return {array} List of Labels (an array of arrays) that will be inserted into the DB on import.
*/
\add_filter(
'Figuren_Theater\Label_Printing\Patterns\bootstrap_labels',
function( array $default_labels ) : array {
return [
[
'name' => 'A6 Landscape (4 Labels per A4)',
'width' => 148, // in mm
'height' => 105, // in mm
'a4_border_tb' => 0, // in mm
'a4_border_lr' => 0, // in mm
'orientation' => 'landscape',
],
[
'name' => 'Minis (64 Labels per A4)',
'width' => 48, // in mm
'height' => 17, // in mm
'a4_border_tb' => 13, // in mm
'a4_border_lr' => 8, // in mm
'orientation' => 'portrait',
],
];
}
);
wp_block
post_type with _label-printing
post_metaThe data for the physical labels, is saved within the wp_block
post_type, because it seemed plausible to keep reusable labels with reusable posts. All measurements like width and height are stored as an array into one post_meta field.
wp_pattern_category
taxonomy with „Label Printing“ (label-printing
) termTo keep the label wp_block
posts separated from other posts of the same post_type, all labels are grouped under one term in the (new since 6.4) wp_pattern_category
. This term is used to query labels when selecting them in the Label Printing block.
post_or_whatever
post_typeThe content to print on each label is saved within that post_type where you added the Label Printing block. This can be a normal, private, or any other custom post_type. Separating label measurements from content ensures efficient label management and accessibility to all editors.
We are doing theater, for a living. For more than ten years we do one to three productions each year and try to keep the performances in the schedules of festivals and theaters for multiple years.
From the very beginning we produced posters and flyers with all relevant data about the show but no dates or venues at all. This behavior allowed us to produce 2.000 posters and 5.000 flyers once before the premiere and often supported by funding and use the materials for years, with the help of labels.
Using labels helps supporting the nature because it reduces the trash of unused materials, it reduced regular re-prints, delivery and the related emissions.
With some automation in place the time to create the labels will be a minimum, I thought.
I ended up with more than 15 different label-templates, Adobe Indesign Templates; and me the only one able to manage and handle these templates. And at this point I switched machines, got rid of windows and wanted to even get rid of Indesign. So I would have had to create all the templates now in scribus to get to the same workflow. And after all the possible migration hurdles, I’ll be the only one able to manage the new and fancy scribus templates. No way. So created this block. Now everyone on the team is able to create labels.
The installation process for the Label Printing block plugin is straightforward:
label-printing
folder to the /wp-content/plugins/
directory.composer require figuren-theater/label-printing
The default labels, if not changed via the Figuren_Theater\Label_Printing\Patterns\bootstrap_labels
filter, are:
`
\$bootstrap_labels = [
[
'name' => 'A6 Landscape',
'width' => 148,
'height' => 105,
'a4_border_tb' => 0,
'a4_border_lr' => 0,
'orientation' => 'landscape',
],
[
'name' => 'A6 Landscape (with Top-Bottom-Borders)',
'width' => 148,
'height' => 90,
'a4_border_tb' => 15,
'a4_border_lr' => 0,
'orientation' => 'landscape',
],
[
'name' => 'A8 Portrait',
'width' => 52.5,
'height' => 74,
'a4_border_tb' => 0,
'a4_border_lr' => 0,
'orientation' => 'portrait',
],
[
'name' => 'A8 Landscape',
'width' => 74,
'height' => 52.5,
'a4_border_tb' => 0,
'a4_border_lr' => 0,
'orientation' => 'landscape',
],
];
`
blank.php
templateMake sure to only print what you really need. If the Print Preview in your browser shows your normal header including logo and navigation, consider selecting only the necessary page in your native print dialog.
Using a blank.php
template ensures that only the necessary content is printed. If your theme provides this template, it's the best choice to avoid unnecessary headers, post titles, and footers in your printed materials.
figuren-theater/label-printing
is a custom block that uses normal innerBlocks
to keep the blocks, you are going to add to your label.
To preview the block in the editor and also to render it on the front-end, it uses a hidden, second block called figuren-theater/label-proxy
. This is a lightweight version of a reusable block, that only works within one post, and not across multiples.
Depending on your selected pre-defined label the …/label-proxy
block will be duplicated as often as the dimensions of the selected label allow. In other words, your label will be fitted into an A4 print-template as often as possible.
plugin.php
, README.md
and the CHANGELOG.md
are automatically updated for each release (via GitHub actions)create-block
packagewp-admin-color-scheme
.README.md
as valid readme.txt for the wp.org/plugins repository(silence is golden)
Read the changelog partial for the latest release.
We keep a Changelog in the CHANGELOG.md
file.