Make a heading, caption or price editable
fld-text="Field name" The most common attribute: a one-line text field in the admin. The client changes the words, the design stays as it is.
Where it goes
On the element that holds the text: a heading, a paragraph, a <span> with a price, a link’s caption. The value of the attribute is the field’s label in the admin, so write it the way the client will understand it.
The text that is in the HTML now becomes the field’s first value when you press “Load data” in the admin.
The field appears in the admin only if the page has a group name: wp-fields-group on its <body>.
Example: the hero of the home page
<section class="hero">
<p class="eyebrow" fld-text="Eyebrow">Open every day</p>
<h1 fld-text="Hero title">Coffee for slow mornings</h1>
<span class="price" fld-text="Latte price">$4.20</span>
</section>Open every day
Coffee for slow morningsThe client changed the price to $4.50; the markup did not change.
What matters
- The field replaces everything inside the element, tags included. If part of the heading has its own style, give that part its own field.
- One field per name in a group: two elements with
fld-text="Price"show the same value. - An empty field prints nothing: the text from the HTML is only the starting value, not a fallback.
- For several lines use fld-area, for formatted text fld-editor.
Common mistakes
The build log is the “Logs” tab of your project on themeforge.pro; the free markup check shows the same notes.
<h1 fld-text="Hero title">Coffee for
<span class="accent">slow mornings</span></h1>The field takes the whole heading, so the accent <span> and its style disappear. The log is silent.
<h1><span fld-text="Hero title">Coffee for</span>
<span class="accent" fld-text="Hero accent">slow mornings</span></h1>Each styled part has its own field.
<h1 fld-text="">Coffee for slow mornings</h1>No name: the build log reports the attribute and the text stays fixed.
<h1 fld-text="Hero title">Coffee for slow mornings</h1>Every field has a name.
The same in site settings or on a category
fld-text | on a page or post, as above |
|---|---|
opt-text | in site settings: one value for every page, such as a phone in the header |
tax-text | on a category or tag: each term has its own value |
Alternative spelling
f_text, o_text, t_text works the same: the build gives an identical theme.