Skip Navigation

[Resolved] Adding an increasing number next to the field

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 7 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#574938

hi,

so this is the code that I've been trying to edit:

[types field='steps' separator='</br><h4>Step</h4>'][/types]

How can I add an increasing number after the h4 text 'Step' ? step field is a single line. You get to add more than one single line. so it is going to look like this for every line:

Step 1
Content
Step 2
Content
Step 3
Content
Step 4
Content

Thank you for your help! You guys are the best.

#575015
Bildschirmfoto 2017-09-30 um 09.46.31.png

What you need is a simple numbered list.

Customize that list to output "Step n" instead of "n." which is the native default.
Then separate with the separator attribute by passing the correct HTML markup.

It looks like this afterwards in your text editor:

<ol id="customlist">
 	<li>[types field='types-field' separator='</li><li>'][/types]</li>
</ol>

As you see, I add a Custom CSS class to the wrapping OL element.

This later allows me to customize this with some CSS:

#customlist {
  /* delete default counter */
  list-style-type: none;
  /* create custom counter and set it to 0 */
  counter-reset: elementcounter;
}
#customlist>li:before {
  /* print out "Step " followed by the current counter value */
  content: "Step " counter(elementcounter) ": ";
  /* increment counter */
  counter-increment: elementcounter;
}

This code produces then something like you see in the screenshot.