How to make slider images clickable


#1

Hi There,

I’m trying to modify the slider images to make them clickable. I have already created new fields for each slide to have a unique button url now I want to use the url to make the images clickable. Here is what I’m trying and it’s not really working. Any help you could give I would really appreciate!

    if ( get_theme_mod('slider_image_1', get_template_directory_uri() . '/images/1.png') ) {
			echo '<a>"&gt;&lt;div class="slide-item" style="background-image:url(' . esc_url(get_theme_mod('slider_image_1', get_template_directory_uri() . '/images/1.jpg')) . ');"&gt;&lt;/div&gt;</a>'    
			}

#2

Hello there,

Try to define a link inside the DIV.slide-item. So the code will look like this.

Then, you need to make the link covers the entire slide item. Try to apply the following CSS code through the Simple Custom CSS plugin or child theme’s style.css:

.slide-item a{
  display: block;
  width: 100%;
  height: 100%;
}

Let me know how it goes.

Regards,
Kharis