Skip Navigation

[Résolu] Image gallery with ToolSet

This support ticket is created Il y a 5 années et 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

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

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

Assisté par: Nigel.

Auteur
Publications
#1246307

Hi

Here is an example of something we regularily do with some Joomla CCKs we want to know how to do with Toolset

Let's define a content type we name 'galery'. The galery is a content that contains several images.

1- is there a custom field type that allows us to upload X images ?
2-is there a way to automatically generate various thumbnails for each uploaded images ?
3-when we display a 'galery' content can we add custom code to the content vew done with toolSet Layouts ?

Thanks

#1246350

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Cyril

You can add an image field to your post type and make it repeating (i.e. choose "Allow multiple-instances of this field ").

So each of several image field entries relates to an individual post.

Generating a gallery from these images involves iterating over the fields and outputting the required markup.

There is a description of how to do that in this document, which covers doing it with and without using the new Toolset Blocks: https://toolset.com/documentation/user-guides/create-image-galleries-using-toolset-and-custom-fields/

If you are reasonably technical you may be interested in an earlier thread where I talked about integrating a 3rd party slider library if you wanted to take advantage of that: https://toolset.com/forums/topic/how-to-display-the-pics-i-uploaded-as-a-slider/#post-518295

As regards generating thumbnails, WordPress does this automatically. It has several default sizes, and you can register custom sizes, and then whenever an image is uploaded to the media gallery the various sizes are generated automatically. You can read more about that here: https://developer.wordpress.org/reference/functions/add_image_size/

You may also find this link helpful, where you can import pre-existing modules for generating sliders with thumbnails:
https://toolset.com/2019/02/create-your-own-sliders-with-thumbnails-its-easy-now/

I didn't follow question 3.

#1246415

Thanks Nigel

I will study all that

Why the page https://toolset.com/documentation/user-guides/create-image-galleries-using-toolset-and-custom-fields/ is not available from https://toolset.com/documentation/user-guides ?

as for question 3 I want to know how we can put custom code in the gallery display view please

thanks

Cyril

#1246417

Thanks Nigel

I will study all that

Why the page https://toolset.com/documentation/user-guides/create-image-galleries-using-toolset-and-custom-fields/ is not available from https://toolset.com/documentation/user-guides ?

as for question 3 I want to know how we can put custom code in the gallery display view please

thanks

Cyril

#1246419

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Cyril

I've mentioned that to the documentation team.

Custom code: you are talking about JavaScript?

If you are using a View to display a gallery the editors within the View (e.g. the Search and Pagination editor, the Loop Output editor) have sections for adding custom JS (and also custom CSS).

#1246422

no, I meant PHP code, on the server side.
the general idea is to be able to add custom code (hooks) that will perform some actions on the content view.

For example : take the value of a hidden field and appy its value as a href on another field

thanks

cyril

#1246431

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

You can see a complete list of the available hooks for Views here: https://toolset.com/documentation/programmer-reference/views-filters/

I think the ones that might interest you would be wpv_filter_content_template_output, and possibly wpv-before-display-post or wpv-after-display-post

#1246432

I saw https://toolset.com/documentation/programmer-reference/views-filters/ but this page only shows hooks for the VIEWS plugin.
my question was about the hooks for one content type display, not a list

thanks

cyril

#1246457

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

The description for the wpv_filter_content_template_output filter says "Filters the output generated by a Content Template or, in general, the content of any post."

I haven't tested it but according to that it looks like it should be triggered whether you are outputting a list of posts with a View or just outputting a single post.

It may be helpful to understand how templates work with Toolset.

A theme would normally contain a single.php file which will output various fields and the output the actual body of the post using the standard the_content() function. WordPress provides a filter for the output of this function, also the_content.

Toolset uses this filter to replace what would be output by the theme with what should be output by a Views Content Template, or a Template Layout.

My reading of the documentation for the wpv_filter_content_template_output is that it is part of this process and would be triggered even if a Toolset template were not being used, but you could always try using the native WordPress the_content filter (with a very high priority so that it hooks in later than Toolset, I'm not sure what the specific value would need to be).

#1246522

ok great

I tried it and it works with a single post too!

thanks

cyril

#1246582

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Good to know, thanks.

I think you can close here?