How to create an image slider in WordPress without plugin

image slider in WordPress

Photo by: webfactoryltd

Image sliders are a very usual request for websites. There are so many approaches to create an image slider in WordPress and there are too many sliders to use like OWL carousel and Slick slider. Also in WordPress, there is plenty of plugins to use.

Another option could be to use ACF repeater and a preferred slider as we mentioned before. But this is a time-consuming task, as for every image you need to click to add a new row, add a new image, and so on.

One solution, probably not the best but it is simple, is to use a combination of WordPress built-in gallery and OWL carousel. With a gallery, you can select multiple images at once inside the post. This is what I’ll describe in this post.

So for this task, we need:

  • jQuery
  • OWL Carousel
  • A gallery
  • A little bit of CSS
  • A little bit of JavaScript

How to create an image slider in WordPress

We create a page and we create a new gallery

Page creation

We create the gallery and insert images

Create a gallery and insert the images

Gallery settings

On sidebar settings, we choose “Link to none”. In addition, on the Advanced tab we put the two classes we’ll need, owl-carousel and owl-theme. It doesn’t matter the number of columns.

Gallery settings

The page code

    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
      .wp-block-gallery {
        padding: 0;
        list-style-type: none;
        border: 2px solid lightgrey;
    if (have_posts()) : 
      while (have_posts()) : the_post();

    <script src=""></script>
    <script src=""></script>

The final result

Image slider in WordPress
Owl carousel

You can follow the OWL carousel settings for different approaches, responsiveness, and many more.

More Articles

All Articles
All Articles
© Antonis Papadakis 2023. All rights reserved.