Slider Link

Hi There,

I was hoping for some help. I really like the Sparkling theme, but I would like the option to have the images in the slider link to pages other than blog posts. For example, I would like the slider image to point to a blog category page so I can feature a series of blogs instead of one particular post.

I have installed a child theme, but I am stuck there. Any ideas on how I could make this slider work for me in this way? I still want the normal Title text and blog text to overlay over the slider image, but I want a click to take me to the category page.

Thanks in advance!

Hi @stalecrouton,

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

You can achieve this by overwriting the function sparkling_featured_slider in your child theme as described in this reply and then add the category page URL in the href attribute of the anchor tag as following in that function code.

echo '<li><a href="">';

Best Regards,

Thanks Movin! I actually went one further and got it to be a little more dynamic. I made a custom field called slider_link that I apply to blogs that I want in the slider and the slider uses that link. That way I can send people to multiple pages. It could be refined further and I’ll probably keep poking at it, but here is my solution for anybody that wants it.

if ( ! function_exists( 'sparkling_featured_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="'. get_post_meta(get_the_id(), 'slider_link', true) .'">';
            if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
              echo get_the_post_thumbnail();

              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>';
			echo '</a>';

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

Hi @stalecrouton,

Thanks for sharing the solution in the forum.

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