Slider only having one categorie

Hi all,

I wanted to use the slider to show various images pointing to different parts of my website. As it seems, it can only be used to link to posts. At least, I’m only seeing the “common” category (word might be a little different, I have the german wordpress version installed), but no others. In the colorlib documentation for sparkling, it tells me to chose from a dropdown menu. So are there options missing that could help me to achieve what I want to do?

Greetings,
akuji

Hi Akuji,

I hope you are well today and thank you for your question.

You can use the slider to show various images pointing to different parts of your website or any other website by adding the following code in the functions.php file of your child theme

/**
 * Featured image slider, displayed on front page for static page and blog
 */
function sparkling_featured_slider() {
  if ( is_front_page() && of_get_option( 'sparkling_slider_checkbox' ) == 1 ) {
    echo '<div class="flexslider">';
      echo '<ul class="slides">';

        $count = of_get_option( 'sparkling_slide_number' );
        $slidecat =of_get_option( 'sparkling_slide_categories' );

        $query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) );
        if ($query->have_posts()) :
          while ($query->have_posts()) : $query->the_post();
          $slider_image_link_url = get_post_meta(get_the_ID(), 'slider_image_link_url', true);
           $slider_image_link_url = $slider_image_link_url != '' ? $slider_image_link_url : get_permalink();
          echo '<li><a href="'. $slider_image_link_url .'">';
            if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
              echo get_the_post_thumbnail();
            endif;

              echo '<div class="flex-caption">';
                  if ( get_the_title() != '' ) echo '<h2 class="entry-title">'. get_the_title().'</h2>';
                  if ( get_the_excerpt() != '' ) echo '<div class="excerpt">' . get_the_excerpt() .'</div>';
              echo '</div>';

              endwhile;
            endif;

          echo '</a></li>';
      echo '</ul>';
    echo ' </div>';
  }
}

And then set the slider_image_link_url custom field having the page URL as shown in the attached screenshot for the posts displaying in the slider.

I have attached he child theme that contains the above change so you can just download ans use it.

Best Regards,
Movin