$options['featured_one_title'], 'content' => $options['featured_one_content'], 'link' => '#', ), array( 'title' => $options['featured_two_title'], 'content' => $options['featured_two_content'], 'link' => '#', ), array( 'title' => $options['featured_three_title'], 'content' => $options['featured_three_content'], 'link' => '#', ), ); $page_ids = array(); for ( $i = 1; $i <= 3; $i++ ) { $page_id = isset( $options[ 'featured_post_' . $i ] ) ? $options[ 'featured_post_' . $i ] : ''; if ( ! $page_id ) { continue; } $page_ids[] = $page_id; } if ( ! empty( $page_ids ) ) { $services_args = array( 'post_type' => 'post', 'post__in' => $page_ids, 'posts_per_page' => 3, 'orderby' => 'post__in', 'ignore_sticky_posts' => 1, ); $service_post_query = new WP_Query( $services_args ); if ( $service_post_query->have_posts() ) : $i = 0; while ( $service_post_query->have_posts() ) : $service_post_query->the_post(); $title = get_the_title(); $content = get_the_content(); if ( ! empty( $title ) ) { $services_data[ $i ]['title'] = $title; } if ( ! empty( $content ) ) { $services_data[ $i ]['content'] = get_the_excerpt(); } $services_data[ $i ]['link'] = get_permalink(); $services_data[ $i ]['ID'] = get_the_ID(); $services_data[ $i ]['thumbnail_url'] = bizbuzz_get_post_thumbnail_url( get_the_ID(), 'bizbuzz-thumbnail' ); $i++; endwhile; wp_reset_postdata(); endif; } return $services_data; } }