Skip Navigation

[Résolu] Repeater slug

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Solution:
To display the specific instance of repeating fields you can use the "index" attribut.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/repeater-slug/#post-630540

Relevant Documentation:
https://toolset.com/documentation/user-guides/repeating-fields/#Index%20parameter%20Repeating%20Fields

This support ticket is created Il y a 6 années et 8 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par Ljuba Il y a 6 années et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#630429

I'm using for gallery repeater. What is the slug of 'nth' images (second, third, ...), if field slug is 'gallery' (wpcf-gallery)?

Why I ask it?

In CRED I want to have 'repeater' (limited to 6), but I want to display images separately, not in gallery.

#630540

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that you want to limit the number of images uploaded to "(wpcf-gallery)" field to 6 using CRED form?
-- If yes:
- You need to add custom javascript/jquery code to your CRED form's JS box:

jQuery(document).ready(function(){
        allowed_instances= 6;
   
        $(document).on( "click", ".js-wpt-repadd", function(e){
             // how many repetitions?
            if ( $('.wpt-repctl').length > allowed_instances-1 ) {
                // hide button to add more
                $(this).hide();
            }
        });
        // add click listener to trash buttons
        $(document).on( "click", ".js-wpt-repdelete", function(e){
   
            $(".js-wpt-repadd").show();
        });
    });
});

To display the repeating fields you can use the index attribute:
More info:
=> https://toolset.com/documentation/user-guides/repeating-fields/#Index%20parameter%20Repeating%20Fields

#630657

Answer was second ("Index: Displaying a single value for a repeating field") and it works. Thanks.