• Hello!

    Is there a way to only display the Featured Image from each post in the slider? I would like to be able to manually input a different picture as the top image on the actual post page.

    Thank you!

Viewing 1 replies (of 1 total)
  • Hi @stayawakeblogger,

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

    You can achieve this by creating child theme of Activello theme and then add the following custom code in the functions.php file of the child theme.

    /**
     * Featured image slider, displayed on front page for static page and blog
     */
    function activello_featured_slider() {
      if ( ( is_home() || is_front_page() ) && get_theme_mod( 'activello_featured_hide' ) == 1 ) {
    
    		wp_enqueue_style( 'flexslider-css' );
    		wp_enqueue_script( 'flexslider-js' );
    
        echo '<div class="flexslider">';
          echo '<ul class="slides">';
    
            $count = -1;
            $slidecat = get_theme_mod( 'activello_featured_cat' );
    
            $query = new WP_Query( array( 'posts_per_page' => $count ) );
            if ($query->have_posts()) :
              while ($query->have_posts()) : $query->the_post();
    
                if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
    
                    echo '<li>';
                          echo get_the_post_thumbnail( get_the_ID(), 'activello-slider' );
    
                        echo '<div class="flex-caption">';
                          echo get_the_category_list();
                            if ( get_the_title() != '' ) echo '<a href="' . get_permalink() . '"><h2 class="entry-title">'. get_the_title().'</h2></a>';
                            echo '<div class="read-more"><a href="' . get_permalink() . '">' . __( 'Read More', 'activello' ) .'</a></div>';
                        echo '</div>';
    
                    echo '</li>';
                endif;
    
            endwhile;
            wp_reset_query();
            endif;
    
          echo '</ul>';
        echo ' </div>';
      }
    }

    Best Regards,
    Vinod Dalvi

Viewing 1 replies (of 1 total)
  • The topic ‘Only Display Featured Image In Slider’ is closed to new replies.