Website Building » Elementor » How do I use filterable gallery in Elementor?

How do I use filterable gallery in Elementor?

Last updated on December 25, 2022 @ 12:53 pm

If you are looking to add a filterable gallery to your Elementor website, then you are in luck! Elementor has built-in support for galleries, so all you need to do is add a few lines of code to your template.

To add a filterable gallery to your Elementor website, simply add the following code to your template:

<style>
  .gallery {
    height: 500px;
}
</style>
<div class="gallery">
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="item">
      <?php the_post(); ?>
    </div>
  <?php endwhile; ?>
  <?php endif; ?>
  <?php wp_footer(); ?>
</div>
<!-- Add this line to the bottom of your template -->
<?php wp_footer(); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery
/1.12.4/jquery.min.js"></script>
  
<script src="https://cdn.Elementor.com/3.8.1/js/
Elementor.core.gallery.js"></script>

Simply add the following code to the bottom of your template to add the gallery:

PRO TIP: The filterable gallery feature in Elementor can be very helpful, but it’s important to be aware that it can also be abused. If you’re not careful, you could easily end up with a gallery that’s full of images that are all the same size and shape, which isn’t very visually appealing. Additionally, if you use too many filters, you could end up making it difficult for users to find the images they’re looking for. So, as with all things, use this feature in moderation and make sure that you’re using it to enhance the user experience, not create more work for them.
<gallery id="gallery" class="gallery">
  <?php if ( have_posts() ) : 
while ( have_posts() ) : the_post(); ?>
 
    <div class="item">
      <?php the_post(); ?>
    </div>
  <?php endwhile; ?>
  <?php endif; ?>
  <?php wp_footer(); ?>
</gallery>

Now, you can add any type of gallery you want to your Elementor website! Simply add a few lines of code to your template, and you are good to go.

Conclusion

In this article, we have shown you how to add a filterable gallery to your Elementor website. Simply add the code mentioned above to your template, and you are good to go.

You can now add any type of gallery you want to your website, without having to worry about coding or styling.

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.