1. PROMO Get 60% OFF Lifetime Pro Membership & access all our Pro Divi Extensions, Divi Layouts, Divi AI Generator, Divi Block, etc.VIEW PRICING
Dismiss Notice
UPDATE Custom Color Scheme + Premade Divi Layouts - A perfect combination to boost productivity. New 'Gadget Repair' layout added.Try our Custom Color Layouts
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.
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 Archive Plugin - Replace the default archive "Older Entries" with beautiful pagination: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 slide in bar design for your Divi site without using any plugins:View Demo
  4. Divi Booster

    Divi Booster Divi Expert

    You're welcome, Daniel :)