title: Count Total number of slide loop and show only those PHP
body: <p>PHP show total number of Active slides what I'm using </p>
  
  <p>I have 5 sliders but if user upload only 2 slides then loop still continue. I want to stop loop after last slide.</p>
  
  <p>I'm using setting for images : slideimg1, slideimg2, slideimg3....slideimg5 (same for link and text)</p>
  
  <pre><code>
  $slider_flag = false;
                  for ($i=1;$i&lt;5;$i++)
                      if ( get_theme_mod('slideimg'.$i, true) != "" ) {
                          echo "&lt;a href='".esc_url(get_theme_mod('slidebnlink'.$i, true))."'&gt;
  &lt;img src='".get_theme_mod('slideimg'.$i, true)."' title='".get_theme_mod('slidebntext'.$i, true)."'&gt;&lt;/a&gt;";                      
                          $slider_flag = true; } 
  
  </code></pre>
  
  <p>I'm thing that last value of image call in and stop there </p>
  
  <pre><code>echo $input = get_theme_mod('slideimg'.$i);
  echo $newString = preg_replace("/[^0-9.]/", '', $input);
  
  </code></pre>
  
  <p>but this return error and image link string remove only.</p>