mardi 26 mai 2015

Wordpress checkbox slider

Using template Sparkling: http://ift.tt/1LGRMDv

Here slider uses a category for displaying slides.

Slider Code:

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>';
            if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
              echo get_the_post_thumbnail();
            endif;

              echo '<div class="flex-caption">';
                echo '<a href="'. get_permalink() .'">';
                  if ( get_the_title() != '' ) echo '<div class="slider-title">'. get_the_title().'</div>';
                  if ( get_the_excerpt() != '' ) echo '<div class="excerpt">' . get_the_excerpt() .'</div>';
                echo '</a>';
              echo '</div>';

              endwhile;
            endif;

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

How to change it to use checkbox from post page editor instead of using selected category?

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire