Navigation überspringen

[Gelöst] Limit the number of images in the custom field image gallery

This support ticket is created vor 4 Jahren, 2 Monaten. 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von avansisI-2 vor 4 Jahren, 2 Monaten.

Assistiert von: Shane.

Author
Artikel
#1848653

I need to limit the number of images in the custom field image gallery

Could you help me?

#1848747

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hello,

Thank you for getting in touch.

A formal feature request has been made for this already, however what I can do is to add your ticket to this feature request.

Currently the only way to do this is to use custom code to achieve this. Is this for the frontend or backend ?

For the frontend you can try using the code in the link below.
https://toolset.com/forums/topic/limit-number-of-multiple-instance-fields/#post-200364

Thanks,
Shane

#1848763

In the front end.

The code on it doesn't work for me, maybe I'm not putting it right.

jQuery(function( $ ) {
$("a.galeria_imagenes").click(function( event ) {
    $length = $('div.galeria_imagenes-field').length;
  if($length>=5)
  {
    $("a.galeria_imagenes-field").hide();
  }
})
});
#1848775

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Can you provide me with a link to the form on the frontend so that I can have a look ?

If the form requires login then you can provide the credentials in the private fields.

Thanks,
Shane

#1848943

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hello,

Try using this code here

jQuery(function( $ ) {
$("a.js-wpt-repadd").click(function( event ) {
    $length = $('.galeria_imagenes .wpt-repctl').length;
  if($length>=6)
  {
    $(".galeria_imagenes a.js-wpt-repadd").hide();
  }
})
});

This should work now as i've tested it on your frontend and it works fine.

Thanks,
Shane

#1848965

My issue is resolved now. Thank you!