'page', 'posts_per_page' => absint( $featured_slider_number ), 'post__in' => $ids, 'orderby' => 'post__in', ); // Fetch posts. $all_posts = get_posts( $qargs ); $slides = array(); if ( ! empty( $all_posts ) ) { $cnt = 0; foreach ( $all_posts as $key => $post ) { if ( has_post_thumbnail( $post->ID ) ) { $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'foodland-featured-content' ); }else{ $image_array = array ( get_template_directory_uri() . '/images/no-thumbnail-image-336x224.png' ); } $slides[ $cnt ]['images'] = $image_array; $slides[ $cnt ]['title'] = $post->post_title; $slides[ $cnt ]['url'] = get_permalink( $post->ID ); $cnt++; } } if ( ! empty( $slides ) ) { $input = $slides; } break; default: break; } return $input; } endif; if ( ! function_exists( 'foodland_add_featured_content' ) ) : /** * Add featured content. * * @since Foodland 0.2 */ function foodland_add_featured_content() { $flag_apply_content = apply_filters( 'foodland_filter_featured_content_status', false ); if ( true !== $flag_apply_content ) { return false; } $content_details = array(); $content_details = apply_filters( 'foodland_filter_featured_content_details', $content_details ); if ( empty( $content_details ) ) { return; } // Render featured content now. foodland_render_featured_content( $content_details ); } endif; if ( ! function_exists( 'foodland_render_featured_content' ) ) : /** * Render featured content. * * @since Foodland 0.2 * * @param array $content_details Details of featured content. */ function foodland_render_featured_content( $content_details = array() ) { if ( empty( $content_details ) ) { return; } $options = foodland_get_theme_options(); if( ( ! $foodland_featured_content = get_transient( 'foodland_featured_content' ) ) ) { echo ''; $foodland_featured_content = ''; $foodland_featured_content .= '
'; set_transient( 'foodland_featured_content', $foodland_featured_content, 86940 ); } echo $foodland_featured_content; } endif; if( ! function_exists( 'foodland_featured_content_status' ) ) : /** * Check status of featured content. * * @since Foodland 0.2 */ function foodland_featured_content_status( $input ) { global $post, $wp_query; $options = foodland_get_theme_options(); // Featured content status. $featured_slider_status = $options[ 'featured_content_option' ]; // Get Page ID outside Loop. $page_id = $wp_query->get_queried_object_id(); // Front page displays in Reading Settings. $page_on_front = absint( get_option( 'page_on_front' ) ); $page_for_posts = absint( get_option( 'page_for_posts' ) ); switch ( $featured_slider_status ) { case 'homepage': if ( $page_on_front === $page_id && $page_on_front > 0 ) { $input = true; } break; case 'disabled': $input = false; break; default: break; } return $input; } endif;