No featured image from blog post on the Flexslider

Hello,

I would like to keep flexslider on my homepage only, with no links to anything (will be used for non-slider purposes)

I do not want the featured images from my blog post to show on the flexslider. I want to be able to add whatever images I choose to the flexslider and not have it connected or linked to anything. I want the slider to be “stand alone” if that makes sense I still want to keep the blog posts with the featured images on my home page.

Thanks in advance for your help

Hi @em2105,

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

You can try achieving this by modifying the code written in the following function sparkling_featured_slider that displays the slider.

/**
 * 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();

          echo '<li><a href="#">';
            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>';
  }
}

You can overwrite the above function by copy pasting it in the functions.php file of your child theme.

Please don’t make changes directly in the Sparkling theme file because if you make changes in the theme file then you have to make these changes again after theme updation as changes made in the theme file get lost on theme updation.

I have attached the Sparkling child theme to this reply which contains the above function in the functions.php file so just download it and edit the above function however you want.

Best Regards,
Movin