Sauter la navigation

Dynamic Galleries and Sliders for Templates, Displaying Repeating Image Fields dans WordPress

In this lesson, you will learn how to add dynamic galleries and sliders to templates. These galleries and sliders will display content from repeating image fields.

Durée

Before you get started, identify which « post type » you are working on. You will create or edit a template that shows all the items of a certain post type.

Follow these steps

  1. Navigate to Toolset→Dashboard and click to create or edit the fields group for the post-type.
  2. Add to the post-type a custom field of type Image field. Make it a repeating.
  3. Add sets of images to the different posts (use the repeating image field that you just created).
  4. Navigate to Toolset→Dashboard and click to Create or edit a Content Template for your post type.
  5. When editing the Content Template, insert Toolset Gallery or Toolset Image Slider blocks and select a layout.
  6. Click to use dynamic sources and then select the custom field you created in step 2.
  7. Style your gallery block or slider block.

The gallery and image blocks offer a number of styling options.

You can:

  • Select the number of columns
  • Turn image cropping on and off
  • Display or hide captions
  • Change the slider output style
  • Style the captions (but not edit their text)

Remember that you are adding a gallery or a slider onto a template. If you want to modify the images that different posts show using this template, you need to edit the posts. The template only shows the images that belong to each post.

Edit the individual posts to:

  • Select different images
  • Reorder the images
  • Edit image captions

You can apply different options to your images. Check out the lesson about displaying images with Toolset to learn more.

Main Toolset Block Used in this Lesson

Affichez des images sous forme de galerie

Updated
juin 1, 2021