1. PROMO Get 60% OFF Lifetime Pro Membership & access all our Pro Divi Extensions, Divi Layouts, Divi AI Generator, Divi Block, etc.VIEW PRICING
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color.
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Fullwidth Slider showing numbers instead of title

Discussion in 'Free Divi Community Forum' started by Daniel Strum, Jun 30, 2024.

  1. Daniel Strum

    Daniel Strum New Member

    I have had a fullwidth slider on my homepage for many years but this is the first time I have had more than 6 slides. When I added the 7th slide, the displayed title for the last slide changed from "Newsletter" to "7" and if I add another one, it displays the title "8". See attached image showing the slide that is titled "Newsletter" but displaying "7". Any ideas?
     

    Attached Files:

    1. PRO MEMBER PERKS Divi Ultimate Blog Plugin - Easily set awesome default design for your Divi single blog page:Learn More
  2. Divi Booster

    Divi Booster Divi Expert

    Hey Daniel, you have the following code in your child theme's makan.js file:

    Code:
      // Hero Slider Pagination
      function heroSlider() {
        $('.et-pb-controllers').addClass('loaded');
    
        $('.et-pb-controllers a').each(function() {
          // Slide 1
          if ($(this).text() == '1') {
            var title = $('.et_pb_slide_0 .slide-title').text();
    
            $(this).text(title);
          }
          // Slide 2
          if ($(this).text() == '2') {
            var title = $('.et_pb_slide_1 .slide-title').text();
    
            $(this).text(title);
          }
          // Slide 3
          if ($(this).text() == '3') {
            var title = $('.et_pb_slide_2 .slide-title').text();
    
            $(this).text(title);
          }
          // Slide 4
          if ($(this).text() == '4') {
            var title = $('.et_pb_slide_3 .slide-title').text();
    
            $(this).text(title);
          }
          // Slide 5
          if ($(this).text() == '5') {
            var title = $('.et_pb_slide_4 .slide-title').text();
    
            $(this).text(title);
          }
          // Slide 6
          if ($(this).text() == '6') {
            var title = $('.et_pb_slide_5 .slide-title').text();
    
            $(this).text(title);
          }
        });
      }
    
    It's converting the control dots to titles in your slider, but is only coded to go up to slide 6. after that the default text of the control dot (e.g. "7", "8", etc, is used).

    While you could solve this by adding additional lines for each slide, you might find it more convenient to replace this function with a loop that can handle any number of slides - something like this:

    Code:
    function heroSlider() {
      $('.et-pb-controllers').addClass('loaded');
    
      $('.et-pb-controllers a').each(function(index) {
        var slideIndex = index + 1; // Add 1 because .et_pb_slide indexes start from 0
    
        var title = $('.et_pb_slide_' + index + ' .slide-title').text();
        $(this).text(title);
      });
    }
     
  3. Daniel Strum

    Daniel Strum New Member

    Thank you so much Dan... That did the trick.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade before / after image slider for your Divi site without using any plugins:View Demo
  4. Divi Booster

    Divi Booster Divi Expert

    You're welcome, Daniel :)