Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This function displays featured posts on homepage header without the links by overriding parent function
- */
- function simplecatch_sliders() {
- //delete_transient( 'simplecatch_sliders' );
- global $post, $simplecatch_options_settings;
- $options = $simplecatch_options_settings;
- $postperpage = $options[ 'slider_qty' ];
- $slidereffect = $options[ 'remove_noise_effect' ];
- if( ( !$simplecatch_sliders = get_transient( 'simplecatch_sliders' ) ) && !empty( $options[ 'featured_slider' ] ) ) {
- echo '<!-- refreshing cache -->';
- $simplecatch_sliders = '
- <div id="main-slider" class="post-slider">
- <section class="featured-slider">';
- $get_featured_posts = new WP_Query( array(
- 'posts_per_page' => $postperpage,
- 'post__in' => $options[ 'featured_slider' ],
- 'orderby' => 'post__in',
- 'ignore_sticky_posts' => 1 // ignore sticky posts
- ));
- $i=0; while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++;
- $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
- $excerpt = get_the_excerpt();
- if ( $i == 1 ) { $classes = "slides displayblock"; } else { $classes = "slides displaynone"; }
- $simplecatch_sliders .= '
- <div class="'.$classes.'">
- <div class="featured-img">';
- if( has_post_thumbnail() ) {
- $simplecatch_sliders .= '<a href="javascript:void(0);" title="Permalink to '.the_title('','',false).'">';
- if( $slidereffect == "0" ) {
- $simplecatch_sliders .= '<span class="img-effect pngfix"></span>';
- }
- $simplecatch_sliders .= '<figure>'.get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ).'</figure></a>';
- }
- else {
- $simplecatch_sliders .= '<span class="img-effect pngfix"></span>';
- }
- $simplecatch_sliders .= '
- </div> <!-- .featured-image -->
- <article class="featured-text">';
- if( $excerpt !='') {
- $simplecatch_sliders .= the_title( '<span class="slider-title">','</span>', false ).'<span class="slider-sep">: </span><span class="slider-content">'.$excerpt.'</span>';
- }
- $simplecatch_sliders .= '
- </article><!-- .featured-text -->
- </div> <!-- .slides -->';
- endwhile; wp_reset_query();
- $simplecatch_sliders .= '
- </section> <!-- .featured-slider -->
- <div id="controllers">
- </div><!-- #controllers -->
- </div><!-- #main-slider -->';
- set_transient( 'simplecatch_sliders', $simplecatch_sliders, 86940 );
- }
- echo $simplecatch_sliders;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement