get_queried_object_id(); // Front page displays in Reading Settings $page_on_front = get_option('page_on_front') ; $page_for_posts = get_option('page_for_posts'); if ( $enableslider == 'entire-site' || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && $enableslider == 'homepage' ) ) { if( ( !$automobile_featured_slider = get_transient( 'automobile_featured_slider' ) ) ) { echo ''; $automobile_featured_slider = '
'; // Select Slider if ( $sliderselect == 'demo-featured-slider' && function_exists( 'automobile_demo_slider' ) ) { $automobile_featured_slider .= automobile_demo_slider( $options ); } elseif ( $sliderselect == 'featured-page-slider' && function_exists( 'automobile_page_slider' ) ) { $automobile_featured_slider .= automobile_page_slider( $options ); } $automobile_featured_slider .= '
'; set_transient( 'automobile_featured_slider', $automobile_featured_slider, 86940 ); } echo $automobile_featured_slider; } } endif; add_action( 'automobile_before_content', 'automobile_featured_slider', 10 ); if ( ! function_exists( 'automobile_demo_slider' ) ) : /** * This function to display featured posts slider * * @get the data value from customizer options * * @since Automobile 0.1 * */ function automobile_demo_slider( $options ) { $automobile_demo_slider ='
Slider Image 1

Slider Image 1

Posted on

Slider Image 1 Content

Slider Image 2

Slider Image 2

Posted on

Slider Image 2 Content

'; return $automobile_demo_slider; } endif; // automobile_demo_slider if ( ! function_exists( 'automobile_page_slider' ) ) : /** * This function to display featured page slider * * @param $options: automobile_theme_options from customizer * * @since Automobile 0.1 */ function automobile_page_slider( $options ) { $quantity = $options['featured_slide_number']; $more_link_text = $options['excerpt_more_text']; global $post; $automobile_page_slider = ''; $number_of_page = 0; // for number of pages $page_list = array(); // list of valid page ids //Get number of valid pages for( $i = 1; $i <= $quantity; $i++ ){ if( isset ( $options['featured_slider_page_' . $i] ) && $options['featured_slider_page_' . $i] > 0 ){ $number_of_page++; $page_list = wp_parse_args( $page_list, array( $options['featured_slider_page_' . $i] ) ); } } if ( !empty( $page_list ) && $number_of_page > 0 ) { $get_featured_posts = new WP_Query( array( 'posts_per_page' => $quantity, 'post_type' => 'page', 'post__in' => $page_list, 'orderby' => 'post__in' )); $i=0; while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++; $title_attribute = the_title_attribute( array( 'before' => __( 'Permalink to: ', 'automobile' ), 'echo' => false ) ); $excerpt = get_the_excerpt(); if ( $i == 1 ) { $classes = 'page post-'.$post->ID.' hentry slides displayblock'; } else { $classes = 'page post-'.$post->ID.' hentry slides displaynone'; } $automobile_page_slider .= '
'; if ( has_post_thumbnail() ) { $automobile_page_slider .= ' '. get_the_post_thumbnail( $post->ID, 'automobileslider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'attached-page-image' ) ).' '; } else { //Default value if there is no first image $automobile_image = ''; //Get the first image in page, returns false if there is no image $automobile_first_image = automobile_get_first_image( $post->ID, 'automobileslider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'attached-page-image' ) ); //Set value of image as first image if there is an image present in the page if ( '' != $automobile_first_image ) { $automobile_image = $automobile_first_image; } $automobile_page_slider .= ' '. $automobile_image .' '; } $automobile_page_slider .= '

'.the_title( '','', false ).'

'.automobile_page_post_meta().'
'; if( $excerpt !='') { $automobile_page_slider .= '

'. $excerpt.'

'; } $automobile_page_slider .= '
'; endwhile; wp_reset_query(); } return $automobile_page_slider; } endif; // automobile_page_slider