[Resolved] No clue on how to set up this HTML into a repeatable field

This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation: Adding Custom Fields to WordPress

This topic contains 4 replies, has 2 voices, and was last updated by  jensB-2 2 months ago. The support staff assigned to this topic is Luo Yang.

Viewing 5 posts - 1 through 5 (of 5 total)
Author
Posts
#559230

Hi folks,
I´m working on a custom theme, which uses a lot of custom fields. I´m using the latest version of Toolset Types (free version) and want to create a repeatable field.

This is the HTML code, which schould be written into the site.

<figure id="" class="">
<a id="example4" title="Lorem ipsum dolor sit amet" href="http://farm4.staticflickr.com/3864/14420515212_9999c800b4_b.jpg"&gt;
<img alt="example4" src="http://farm4.staticflickr.com/3864/14420515212_9999c800b4_m.jpg"&gt;
<figcaption>The caption of the image</figcaption>
</a>
</figure>

Though it should be used to create an image gallery, this entire code has to be repeatable.

Custom fields would define:
- the URL in the <a> tag´s href
- the scr of the <img>
- the caption text in <figcaption>

I know how what inputs I have to use for the single fields, but I don´t know how I can set it up to be repeatable and what I have to write into the template file to output the above code in a repeatable way.

I hope I could make clear, what I´m wanting to do and hope you can help me with this.

Thanks in advance.

#559471

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

Supporter Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Jens,

If you have a copy of Views plugin, you can setup it with shortcode [wpv-for-each]:
https://wp-types.com/documentation/user-guides/views-shortcodes/#wpv-for-each

If you don't have Views plugin, you will need to create a custom shortcode for it, for example:
https://wp-types.com/forums/topic/image-field-type-featured-image-how-can-i-display-image-title-alt-desc/#post-100666

#559766

Hi,
thank you for your help.

I found this article in the documentation, with which I could assign the fields as repeating field group to my custom post type:
https://wp-types.com/documentation/user-guides/creating-groups-of-repeating-fields-using-fields-tables/

But I don´t know, how I can output the data in my template file with PHP.

Is there any clear documentation about this for not advanced PHP users?

#559801

Luo Yang
Forum moderator

Supporter languages: English (English ) Chinese (Simplified) (简体中文 )

Supporter Timezone: Asia/Hong_Kong (GMT+08:00)

You can follow our document to setup your custom PHP codes:
https://wp-types.com/documentation/customizing-sites-using-php/displaying-child-posts/

section "Displaying child post contents"

#560142

Fantastic.
This works like a charm.

Thank you very much for your help.

Viewing 5 posts - 1 through 5 (of 5 total)

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.