Problems with slider - how to use slider on all pages for Sparkling theme

Hello,

I am novice on wordpress. I have donwlaoded Sparkling theme. But I have few questions concerning the slider.

-The slider and the Nav menu are superimposed. I would like to have the Nav menu on the top and the slider underneath it if this is possible ?

  • I also would like to put this slider on every pages of my wordpress.

  • I also tried to find where I am supposed to put the pictures for the slider without success. With which folder I am supposed to do that ?

Thank you in advance to take time to answer my questions.

ps: uncuthiphop.nl (if you want to see by yourself my slider’s problem.)

Florent

1./3. Both ar related problems. Since you don’t have any featured images selected for slider, slider is not working properly and it goes above menu. Once you will add images both of your problems will be solved. Here is how you can use featured images in WordPress. Recommended image sizes for this theme can be found on theme documentation.

  1. To add slider on all pages you will have to edit template files as there is no options for that by default. Open functions.php file and replace these lines of code:
  // Add slider CSS only if is front page and slider is enabled
  if( ( is_home() || is_front_page() ) && of_get_option('sparkling_slider_checkbox') == 1 ) {
    wp_enqueue_style( 'flexslider-css', get_template_directory_uri().'/inc/css/flexslider.css' );
  }
  if( ( is_home() || is_front_page() ) && of_get_option('sparkling_slider_checkbox') == 1 ) {
    wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/inc/js/flexslider.min.js', array('jquery'), '20140222', true );
  }
  // Flexslider customization
  if( ( is_home() || is_front_page() ) && of_get_option('sparkling_slider_checkbox') == 1 ) {
    wp_enqueue_script( 'flexslider-customization', get_template_directory_uri() . '/inc/js/flexslider-custom.js', array('jquery', 'flexslider-js'), '20140716', true );
  }

Keep in mind that these lines are not together on that file.

And replace those lines with these:

  // Add slider CSS only if is front page ans slider is enabled
  wp_enqueue_style( 'flexslider-css', get_template_directory_uri().'/inc/css/flexslider.css' );

  // Flexlider library
  wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/inc/js/flexslider.min.js', array('jquery'), '20140222', true );
  // Flexslider customization
  wp_enqueue_script( 'flexslider-customization', get_template_directory_uri() . '/inc/js/flexslider-custom.js', array('jquery', 'flexslider-js'), '20140716', true );

Now you will have slider related CSS and JavaScript printed on all pages which is just part of the process. You will still have to modify slider code itself and here is how you can get it done.

Open file called extras.php that you can find inside sparkling theme folder >> inc. This file can’t be accessed via WordPress dashboard and you should do it via FTP or via your hosting account.

On that file find function called sparkling_featured_slider and replace all function with this code:

if ( ! function_exists( 'sparkling_featured_slider' ) ) :
/**
 * Featured image slider, displayed on front page for static page and blog
 */
function sparkling_featured_slider() {
    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_permalink() .'">';
            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>';
}
endif; 

It looks the same but this code is two lines shorter.

Now you should have slider on all pages.

Let me know if this helps.

Hello,

Thanks a lot for your fast answer !

It almost work for the slider in every pages. But see what’s happening now;
http://uncuthiphop.nl/?cat=1

I think it missing something somewhere. It looks like the function is not on the right place.

Concerning my first question about add pictures on the slider. How I am supposed to do? There is nothing called “flexyslider” on my dashboard. Is that normal ?

THX

Hi again,

I found the problem for the slider in all pages. Now it’s work thanks to you!

It still remain the problem; “how to put pictures on the slider?” Because there is nothing on my dashboard or on my php folders like I said before.

Thank you in advance to take time to answer my questions.

Florent

You simply don’t have featured images selected as you haven’t followed steps described in theme documentation and repeating things didn’t help either.

Read this again and make sure to click on both links and read everything you find there. EVERYTHING!

1./3. Both ar related problems. Since you don’t have any featured images selected for your posts, slider is not working properly and it goes above menu. Once you will add images both of your problems will be solved. Here is how you can use featured images in WordPress. Recommended image sizes for this theme can be found on theme documentation.

Hi read everything and I already know about the size.
Like I said I am a novice. I use worpress since one week, so please excuse my lake of knowledges.

I stick the option “featured images” but I don’t know how to upload pictures for a slider. Do I need to create something?

When I go to "post> “add new”> and trie to upload my pictures it’s fine. But the thing is I don’t find anythings related to the slider to but the picutre on it. Or nothing to change the text already there…

Featured images are images that will be used inside slider.

For each post that you want to show in slider you select featured image by following this guide. There is no slider images, featured slider images but just Featured Images that will be used inside slider.

Once you have featured images in place but still can’t make slider to work, please let me know but otherwise I can’t help.

Okay thank you for your help. I think wordpress in not adapted for what I am looking for.
You can close this topic. Thanks again. Have a nice day

Is this code still working? i’m trying to get the slider on every pages, I tried this code and got a server error. I can’t find

// Flexlider library
  wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/inc/js/flexslider.min.js', array('jquery'), '20140222', true );

in functions.php

Could someone help, please? Thank you.

@riri

This thread is rather outdated and marked as resolved. I would personally recommend starting you own thread and we will help you from there.