• I like the theme a lot.
    The slider is pretty cool to, but a bit to large for my taste.

    Is it possible to change the height of the slider? Maybe cut it in half?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Silkalns

    (@silkalns)

    Yes, just use smaller images because images that are used in slider are displayed as is (as uploaded). If you will use 1920px by 100px image it will be displayed in that exact size. If you will be using 1920px by 900px image it will still be displayed in that exact size.

    Let me know if this helps

    Thread Starter mattie_d

    (@mattie_d)

    Yes, it works. Thank you.
    Is it also possible to give it a fixed width?

    Theme Author Silkalns

    (@silkalns)

    The easiest method is to use the same image size for all your images that you want o use in slider.
    Another method is to implement cropping. The basic example would be like this:

    1. Create a Child Theme.

    2. Add this to Child Theme functions.php file to register a new thumbnail size. You can use any size you want.

    add_image_size( 'dazzling-featured-slider', 1920, 600, true );

    3. Now add this code inside Child Themefunctions.php. It will change slider output to use previously generated featured images.

    if ( ! function_exists( 'dazzling_featured_slider' ) ) :
    /**
     * Featured image slider
     */
    function dazzling_featured_slider() {
        if ( is_front_page() && of_get_option('dazzling_slider_checkbox') == 1 ) {
          echo '<div class="flexslider">';
            echo '<ul class="slides">';
    
              $count = of_get_option('dazzling_slide_number');
              $slidecat = of_get_option('dazzling_slide_categories');
    
                if ( $count && $slidecat ) {
                $query = new WP_Query( array( 'cat' => $slidecat, 'posts_per_page' => $count ) );
                if ($query->have_posts()) :
                  while ($query->have_posts()) : $query->the_post();
    
                  echo '<li>';
                    if ( has_post_thumbnail() ) { // Check if the post has a featured image assigned to it.
                      the_post_thumbnail( 'dazzling-featured-slider' );
                    }
    
                    echo '<div class="flex-caption">';
                      echo '<a href="'. get_permalink() .'">';
                        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 '</a>';
                    echo '</div>';
    
                    endwhile;
                  endif;
    
                } else {
                    echo "Slider is not properly configured";
                }
    
                echo '</li>';
            echo '</ul>';
          echo ' </div>';
        }
    }
    endif;

    4. These changes are not applied instantly and you need to run Regenerate thumbnail plugin to generate new images. All images that you will upload now will have newly generate image size but old images you need to regenerate manually using plugin mentioned above.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change slider height?’ is closed to new replies.