How do I get only 1 slider image that doesn't link to other blog posts?

I would like to keep the slider on my home page but I only want to have 1 slider image; I want the slider image to remain the same unless I decide to change it. I don’t want this image linking to other posts on my blog. (This part is my biggest issue)

Please advise how this can be done.

Hi @em2105,

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

I would like to keep the slider on my home page but I only want to have 1 slider image;
You can achieve this by setting the 1 slider image for the posts having Slider Category which you have selected in the theme options.
I don’t want this image linking to other posts on my blog. (This part is my biggest issue)

You can achieve this 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();

          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>';
  }
}

Alternatively you can just use the attached child theme that contains the above code.

Best Regards,
Movin

Thanks for the info Movin! I actually just came to that solution on my own. I’m learning! I do have another question however, but I’m not sure if it is possible. It occured to me that I could maybe use a custom field in a blog that the slider is pulling to reference the link I want it to use. That way I could have several sliders in rotation that point to various things.

I tried creating a custom field called slider_link and applying some code based on WP’s documentation, but I couldn’t get anything to work. I would either bring the site down completely, or the slider would simply just link back to the homepage.

I have reverted to the hard-coded link for now, but would love to have this flexibility in the future. Any input would be greatly appreciated.

Thanks!

Hi @stalecrouton,

Actually i have already developed the similar solution previously as shared in the following thread.

https://colorlibsupport.com/t/slider-only-having-one-categorie/#post-27206

Cheers,
Movin