Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Limit Number of Images Displayed

Have you ever wanted to limit images inside a gallery to show only a certain number of images? For example, you can show only 4 images from a gallery that has over 150 images simply by editing the shortcode. Let’s take a look at this document to figure out how!


First, we need add a shortcode for our gallery to our post or page. You can easily add a gallery shortcode to your page by inserting the shortcode from the Add Gallery button that appears on every page and post from your site.

Add the gallery shortcode to your page using the Add Gallery Button

In our case, we added the following shortcode to our visual editor:

[envira-gallery id="131"]

Next, we will need to modify our shortcode. We’re going to add some additional text to the shortcode to limit the number of images from the gallery like so:

[envira-gallery id="131" limit="4"]

As you can see above, all that’s needed to complete the last step is to add the limit option.

As a result of adding that limit option to the shortcode, we have effectively limited the number of images that will show from the gallery to 4.


A: Because you are limiting the number of images in the gallery, the modified shortcode will only show that number of images in the lightbox as well.


[i]
[i]
[i]
[i]