get_queried_object_id(); if ( $enablecontent == 'entire-site' || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && $enablecontent == 'homepage' ) ) { if ( ( !$automobile_header_highlight_content = get_transient( 'automobile_header_highlight_content' ) ) ) { echo ''; $classes = ''; if ( $contentselect == 'demo-header-highlight-content' ) { $classes .= ' demo-header-highlight-content' ; } elseif ( $contentselect == 'header-highlight-page-content' ) { $classes .= ' header-highlight-page-content' ; } $header_highlight_content_number = $options [ 'header_highlight_content_number' ]; $headline = $options ['header_highlight_content_headline']; $subheadline = $options ['header_highlight_content_subheadline']; $classes .= ' layout-' . $header_highlight_content_number; $automobile_header_highlight_content ='
'; if ( !empty( $headline ) || !empty( $subheadline ) ) { $automobile_header_highlight_content .='
'; if ( !empty( $headline ) ) { $automobile_header_highlight_content .='

'. $headline .'

'; } if ( !empty( $subheadline ) ) { $automobile_header_highlight_content .='

'. $subheadline .'

'; } $automobile_header_highlight_content .='
'; } $automobile_header_highlight_content .='
'; // Select content if ( $contentselect == 'demo-header-highlight-content' && function_exists( 'automobile_demo_header_highlight_content' ) ) { $automobile_header_highlight_content .= automobile_demo_header_highlight_content( $options ); } elseif ( $contentselect == 'header-highlight-page-content' && function_exists( 'automobile_header_highlight_page_content' ) ) { $automobile_header_highlight_content .= automobile_header_highlight_page_content( $options ); } $automobile_header_highlight_content .='
'; set_transient( 'automobile_header_highlight_content', $automobile_header_highlight_content, 86940 ); } echo $automobile_header_highlight_content; } } endif; add_action( 'automobile_before_content', 'automobile_header_highlight_content_display', 10 ); if ( ! function_exists( 'automobile_demo_content' ) ) : /** * This function to display header highlight posts content * * @get the data value from customizer options * * @since Automobile 0.1 * */ function automobile_demo_header_highlight_content( $options ) { $automobile_demo_content = '
Gibson Les Paul

Gibson Les Paul

White Velvet Concert

White Velvet Concert

Female Rockstar

Female Rockstar

Great Vocalist

Great Vocalist

Best Rock Band

Best Rock Band

'; return $automobile_demo_content; } endif; // automobile_demo_content if ( ! function_exists( 'automobile_header_highlight_page_content' ) ) : /** * This function to display header highlight page content * * @param $options: automobile_theme_options from customizer * * @since Automobile 0.1 */ function automobile_header_highlight_page_content( $options ) { global $post; $quantity = $options ['header_highlight_content_number']; $number_of_post = 0; // for number of posts $post_list = array(); // list of valid post ids $show_content = isset( $options['header_highlight_content_show'] ) ? $options['header_highlight_content_show'] : 'excerpt'; $output = ''; //Get valid number of posts for( $i = 1; $i <= $quantity; $i++ ){ if( isset ( $options['header_highlight_content_page_' . $i] ) && $options['header_highlight_content_page_' . $i] > 0 ){ $number_of_post++; $post_list = wp_parse_args( $post_list, array( $options['header_highlight_content_page_' . $i] ) ); } } if ( !empty( $post_list ) && $number_of_post > 0 ) { $get_posts = new WP_Query( array( 'posts_per_page' => $quantity, 'post_type' => 'page', 'post__in' => $post_list, 'orderby' => 'post__in', 'ignore_sticky_posts' => 1 // ignore sticky posts ) ); $i=0; while ( $get_posts->have_posts() ) { $get_posts->the_post(); $title_attribute = the_title_attribute( array( 'before' => __( 'Permalink to: ', 'automobile' ), 'echo' => false ) ); $excerpt = get_the_excerpt(); if ( 0 == $i ) { //Set image name to automobileslider 1920x800, if it is the first image $image_size = 'automobileslider'; $article_id = 'large-featured-image'; } else { //Set image name to post-thumbnail 480x320, if it is not the first image $image_size = 'post-thumbnail'; $article_id = 'header-highlight-page-' . $i; } $output .= '
'; if ( has_post_thumbnail() ) { //Pull post thunbnail if it is present $thumbnail = get_the_post_thumbnail( $post->ID, $image_size, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ); } else { $first_image = automobile_get_first_image( $post->ID, $image_size, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ); if ( '' != $first_image ) { $thumbnail = $first_image; } else { $thumbnail = ''; } } $output .= '
'. $thumbnail .'
'; $output .= '

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

'; if ( 'excerpt' == $show_content ) { $output .= '

' . $excerpt . '

'; } elseif ( 'full-content' == $show_content ) { $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); $output .= '
' . $content . '
'; } $output .= '
'; $i++; } wp_reset_query(); } return $output; } endif; // automobile_header_highlight_page_content