Guest User

Untitled

a guest
Sep 9th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1.     function sparkling_featured_slider() {
  2.         if ( is_front_page() && of_get_option( 'sparkling_slider_checkbox' ) == 1 ) {
  3.             echo '<div class="flexslider">';
  4.             echo '<ul class="slides">';
  5.  
  6.             $count = of_get_option( 'sparkling_slide_number' );
  7.             $slidecat = of_get_option( 'sparkling_slide_categories' );
  8.  
  9.             $query = new WP_Query( array(
  10.                 'cat' => $slidecat,
  11.                 'posts_per_page' => $count,
  12.                 'meta_query' => array(
  13.                     array(
  14.                      'key' => '_thumbnail_id',
  15.                      'compare' => 'EXISTS'
  16.                     ),
  17.                 ),
  18.             ) );
  19.             if ( $query->have_posts() ) :
  20.                 while ( $query->have_posts() ) : $query->the_post();
  21.  
  22.                     if ( of_get_option( 'sparkling_slider_link_checkbox', 1 ) == 1 ) {
  23.                         echo '<li><a href="' . get_permalink() . '">';
  24.                     } else {
  25.                         echo '<li>';
  26.                     }
  27.                    
  28.                     if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
  29.                         if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
  30.                             $feat_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
  31.                             $args = array(
  32.                                 'resize' => '1920,550',
  33.                             );
  34.                             $photon_url = jetpack_photon_url( $feat_image_url[0], $args );
  35.                             echo '<img src="' . $photon_url . '">';
  36.                         } else {
  37.                               echo get_the_post_thumbnail( get_the_ID(), 'activello-slider' );
  38.                         }
  39.                     endif;
  40.  
  41.                     echo '<div class="flex-caption">';
  42.                     if ( get_the_title() != '' ) { echo '<h2 class="entry-title">' . get_the_title() . '</h2>';
  43.                     }
  44.                     if ( get_the_excerpt() != '' ) { echo '<div class="excerpt">' . get_the_excerpt() . '</div>';
  45.                     }
  46.                     echo '</div>';
  47.                     echo '</a></li>';
  48.               endwhile;
  49.                 endif;
  50.             wp_reset_postdata();
  51.             echo '</ul>';
  52.             echo ' </div>';
  53.         }// End if().
  54.     }
Add Comment
Please, Sign In to add comment