gillish

Fill a block from your page’s fields

Cairnstone data lets a block A piece of a page, such as a paragraph, a picture or a button. In WordPress you build a page by putting blocks one after another. show a value from the page it sits on, such as its title or a price field. You type the value once on each page, and the block shows it, so one block serves many pages.

You write a field tag where the value should go, such as {Title}. A heading Welcome to {Title} shows “Welcome to Garden Tools” on a page called Garden Tools. You can use several tags in one text, such as {Title} by {Author}, and the words around them are yours.

Insert a field

  1. Open a block you built in the Block workspace, or a post or page.

  2. Select a block that offers it: Hero, Testimonial, Button, Counter, Discount Banner, Author Bio, Audio or Video, or WordPress’s Paragraph.

  3. Open the Cairnstone data panel, right under the block’s own settings.

  4. In the row for the text you want, pick a field under Insert a field to put its tag in the text.

  5. Type around the tag, and save.

A Button whose text holds the page title as a field tag, with Insert a field in the Cairnstone data panel.
A field tag in a Button’s text.

To remove a field, delete its tag like any other word.

The fields you can pick

  • This post: Title, Excerpt, Date, Last modified, Link, Author, Post format.
  • This post’s category, the page’s first category: Name, Slug, Description.
  • Your own fields: type the field’s name in braces, such as {price}. WordPress’s Custom Fields box, under Screen Options when you edit a post, shows a post’s fields. Text in braces that is not a field stays as you typed it. A field that is empty, or whose name starts with an underscore, is not filled in; the tag stays as typed.

An image row offers the page’s Featured image, one of your own fields that holds an image address, or an image from another block on the page.

Fields from your field plugin

If your site uses Advanced Custom Fields (ACF), Secure Custom Fields (SCF), Meta Box, Pods, JetEngine or Toolset, your fields show by their labels in the Cairnstone data panel, in a group with the plugin An add-on you install in WordPress to give your site new features. Gillish Cairnstone and Gillish Core are plugins.‘s own name. Any block can show them: text, choices, yes or no, dates, and pictures with their alt text. Link fields work in all of them but JetEngine.

Meta Box, Pods, JetEngine and Toolset: their tags start with a short name for the plugin, such as {mb:phone}, {pods:phone}, {je:phone} or {toolset:phone}. The alt text of a picture works the same way: {mb:photo:alt}, {pods:photo:alt}, {je:photo:alt} or {toolset:photo:alt}. Pick the field in the panel, and the tag goes in by itself. A Pods link field gives its address and its words: {pods:name} and {pods:name:title}. From JetEngine, Custom Content Types are not read. From Toolset, fields on a post are read, but repeatable field groups, user fields and term fields are not.

In Meta Box, key-value pairs show as text, such as size: M, fit: slim. Text lists and fieldsets show as joined text. A map or OpenStreetMap field shows its position, such as 59.91, 10.75. A background field gives its picture, and a video field the address of its first file. In Pods, an avatar field shows as a picture.

Which plugin: the rest of this section is about the free ACF, ACF PRO and SCF. It works with all three, unless it says Needs ACF PRO or SCF.

Advanced Custom Fields keeps each new field out of the editor until you allow it. Edit the field, open its Presentation tab and turn on Allow Access to Value in Editor UI. A field that is off shows greyed out in the panel, marked as turned off, and shows nothing in the editor or on the page. Fields made before Advanced Custom Fields 6.3.6 count as on.

  • Text: a text field, a number or a date goes into any text. Pick it under Insert a field, or type its name in braces, such as {price}.
  • Image: an image field fills an image setting. The picture takes its alt text from your media library by itself. Alt text is the words that describe a picture to screen readers A program that reads the screen aloud, for people who cannot see it well. They move around the page with the keyboard and hear what is there. and to search engines. Alt text you write in the block goes first.
  • Link: a link field gives two entries: its address, and (the words) for its text. To type the words yourself, write {cta:title}.
  • Page Link: gives the address of the page.
  • Embed: gives the address, for the link in an Audio or Video block. In text you see the address, not a player.
  • Group: the fields inside a group show one by one. To type one yourself, write the group’s name, an underscore and the field’s name, such as {details_price}.
  • Checkbox, Select, Radio and Button Group: these show the words of the choice, not the value stored behind it. Several choices show with commas between them, such as Rack, Lock. A choice you later remove from the field shows its stored value. The field’s Return Format setting does not change what shows.
  • True or false: shows Yes or No.
  • Taxonomy: shows its categories or tags with commas between them, such as Outdoor, Tents. This works in Meta Box and Pods too.
  • Google Map: {map} gives the address, {map:lat} the latitude and {map:lng} the longitude.
  • Icon picker: shows a picture when it holds a media file or an address.
  • Clone, which needs ACF PRO or SCF: the fields inside show one by one, under the names the plugin gives them.

A field called title shows your field: {title}. {Title}, with a capital T, is still the post’s title. A password field never shows on the page. A post locked with a password shows no values from these fields.

Repeater, Gallery, Relationship, Post Object and Flexible Content fields hold rows, so they have their own block, Field Rows, further down this page.

A few field types stay out on purpose: user and password fields, icon fields that only hold an icon’s name (in Meta Box and JetEngine), the SCF menu field and the Pods comment field.

Needs ACF PRO or SCF: you can keep a value for the whole site on an options page, such as your phone number. These fields show in the panel under Site settings, with your plugin’s name after it, and with tags that start with option, such as {option:phone} or {option:cta:title}. They fill any block on any page, also a page with no post behind it, and you see the value in a saved block under Cairnstone → Blocks too. The same switch in the Presentation tab applies. These tags only reach your Advanced Custom Fields fields, so {option:admin_email} stays as typed.

Meta Box, Pods and JetEngine can keep such values on a settings page too. They show under the same group, and their tags are {mb:option:phone}, {pods:option:page.phone} and {je:option:phone}. In the Pods tag, page is the name of your settings page in Pods. They fill any block, and a list on such a page can fill Field Rows.

A settings page in Meta Box needs its MB Settings Page extension. A settings page in Pods is closed to visitors until you make it public in Pods. Until then, its fields are grey in the panel.

In a post or page, click a block in the editor and you see the tag, such as {price}, so you can change it. Click away and you see the value. In a saved Cairnstone block, under Cairnstone → Blocks, there is no page to read from, so you see the tag and an empty picture box. Built-in fields such as {Title} show as written in the editor.

The panel also works on the Image block, Before and After, the photo in Author Bio and Testimonial, the Hero’s two button links, and the Audio and Video links.

Show rows with Field Rows

A field with rows holds a list, such as your team, the pictures of a gallery or a set of related posts. The Field Rows block takes one layout and repeats it for every row. These fields have rows:

  • A list you fill in: a Repeater field in ACF PRO, SCF or JetEngine, or a cloned group in Meta Box, which needs its paid MB Group extension. A row can hold several values. A cloned single field in Meta Box or a repeatable field in Pods or Toolset holds one value a row, {row:value}.
  • A gallery: a Gallery field in ACF PRO or SCF, a picture field in Meta Box that holds several pictures, a file field in Pods that holds several files, or a gallery field in JetEngine.
  • Related posts: a Relationship field in the free Advanced Custom Fields, ACF PRO or SCF, a Post Object field in ACF PRO or SCF, a post field in Meta Box, a relation to posts in Pods, or a posts field in JetEngine.
  • Categories and tags: a Taxonomy field in ACF, SCF, Meta Box or Pods.
  • Flexible Content: in ACF PRO or SCF. A row offers the fields of every layout, and {row:layout} names the layout of that row.
  • Key-value pairs: in Meta Box. Each row gives {row:key} and {row:value}.

The block shows in the block list only on a page with such a field. The free Advanced Custom Fields has no Repeater or Gallery field, so lists and galleries need ACF PRO or SCF there.

Show the rows of a field

  1. In a post or page, add the Field Rows block.

  2. Under Field with rows, choose your field.

  3. The block fills itself with a first row, with a block for each value in it.

  4. Change that row as you like, with any blocks. It repeats for every row of the field.

  5. Save, then view the page.

While you edit, you see your real rows, up to 12. You change the first one. The others are previews.

In any block inside, a tag that starts with row reads the current row: {row:name}. A picture or a link goes one step further: {row:photo:alt} or {row:link:title}. The data panel lists them in a group called This row. Outside a row, such a tag stays as typed.

A gallery starts on the Gallery look, with even square tiles. Each row gives {row:image}, {row:image:alt} and {row:caption}.

Related posts start as a card with the picture, title, excerpt and a Read more button. Each row gives {row:image}, {row:image:alt}, {row:title}, {row:excerpt}, {row:date} and {row:url}. A draft or private post stays out for visitors. A post with no picture draws no picture.

Categories and tags give {row:title}, {row:excerpt} and {row:url} in each row. A category or tag from a taxonomy without public pages stays out.

A picture bound to a row takes its alt text from the media library. A field inside a row with Allow Access to Value in Editor UI off shows greyed out and prints nothing.

Select the block to find its settings:

  • Look: Cards, Lines, Gallery or Plain. It starts on Cards, or on Gallery when you pick a field of pictures.
  • Columns: the most columns that fit, from 1 to 6. It starts on 3. A narrow screen shows fewer by itself, so there is nothing to set for each device. Three columns at 1280 pixels wide become one at 320.
  • Show at most: how many rows to show. 0 shows them all.
  • Skip the first: how many rows to leave out at the start.
  • Sort by: a value in the row. None keeps the order of the field. Turn on Highest or last first to start from the other end.
  • Show only rows by: a value in the row to look in. Under That holds, type a word, such as chef. Capital letters do not matter.
  • Last row first: turns the order around.
  • Text when there are no rows: leave it empty to show nothing.

A Repeater inside a row can have its own Field Rows block. A Repeater on an options page works too. A post locked with a password shows no rows until the visitor enters the password.

The editor shows the same rows, in the same order, as the page. You cannot show the rows in a carousel.

In a paragraph, heading or list

Field tags work in a regular Paragraph, Heading or List on any post or page too, with no panel: use Insert a field in the text toolbar, or type the tag. A Code block and the Code Snippet block leave tags as plain text, so you can show one as an example.

Tags also work in the lists inside a block, such as an FAQ answer, a checklist item, a table cell or a plan’s features. Use Insert a field in the text toolbar, or type the tag. The editor shows the values there too, as the page does.

A colour or a size from a field

Every colour in the Styles tab has a From a field choice under its picker, for a field that holds a colour such as #1a7f5a. The swatch and the block in the editor show what the field holds for that post, and the page paints it. A field that holds anything but a colour paints nothing.

The five size controls in the Styles tab (minimum height, height, minimum width, width and maximum width) have the same From a field choice under the slider, for a field that holds a number. The unit is the one picked on the control, so a field holding 240 draws 240px, or 240% if you pick %. The line under the control shows what the field holds for that post. A field with text in it draws nothing.

Show or hide a block by a field

A field’s value can decide what a visitor sees. A stock count of 0 can hide a buy button, or swap a card for its sold-out look. See Show content to different visitors.

A worked example: one price for many pages

Show each page its own price

  1. Give your product pages a “price” field, for example with WordPress’s Custom Fields.

  2. In the Block workspace, open your block and click into a Hero’s subheading, or use a plain Paragraph.

  3. Type {price} where the number should show, or add your own words around it.

  4. Save the block.

  5. Each product page now shows its own price. Change it on a page, and the block follows.

A button’s link takes a web address, or, with Gillish Node, a short link tag such as [node id="XX"], and points to that managed link’s address. A tag that matches no link leaves the button without a link.

Site-wide tags from Gillish Core

Gillish Core adds tags for values that are the same on every page, written in square brackets: [today] for today’s date, [sitename] for your site name, [c] for the copyright year, and more. Type them in any Cairnstone text, such as a heading, a button, a plan name or a table cell. They fill in on the page, in the editor’s preview, and in a block you export to another site; in the editor you see the tag as you typed it. They need Gillish Core active, with that tag on; otherwise the tag shows as the text you typed, and the page stays whole.

Turn the panel off

The Cairnstone data panel is on to start with. To hide it, go to Cairnstone → Settings → Integrations and switch off Bind block text to your data. Blocks that already show a value keep showing it, and tags typed in a paragraph, heading or list keep working.

Next, read Change a block that is already in use.

Trails

Cairnstone