'post', 'post__in' => ( array ) $post_ids, 'posts_per_page' => absint( $blog_count ), 'orderby' => 'post__in', 'ignore_sticky_posts' => true, ); break; case 'recent': $cat_ids = ! empty( $options['blog_category_exclude'] ) ? $options['blog_category_exclude'] : ''; $args = array( 'post_type' => 'post', 'posts_per_page' => absint( $blog_count ), 'category__not_in' => ( array ) $cat_ids, 'ignore_sticky_posts' => true, ); break; default: break; } // Run The Loop. $query = new WP_Query( $args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $page_post['id'] = get_the_id(); $page_post['title'] = get_the_title(); $page_post['url'] = get_the_permalink(); $page_post['excerpt'] = educollege_trim_content( 20 ); $page_post['image'] = has_post_thumbnail() ? get_the_post_thumbnail_url( get_the_id(), 'large' ) : ''; // Push to the main array. array_push( $content['blog'], $page_post ); endwhile; endif; wp_reset_postdata(); if ( class_exists('TP_Education') ) { switch ( $blog_content_event_type ) { case 'page': $page_ids = array(); for ( $i = 1; $i <= $blog_count; $i++ ) { if ( ! empty( $options['blog_content_event_page_' . $i] ) ) $page_ids[] = $options['blog_content_event_page_' . $i]; } $event_args = array( 'post_type' => 'page', 'post__in' => ( array ) $page_ids, 'posts_per_page' => absint( $blog_count ), 'orderby' => 'post__in', ); break; case 'post': $post_ids = array(); for ( $i = 1; $i <= $blog_count; $i++ ) { if ( ! empty( $options['blog_content_event_post_' . $i] ) ) $post_ids[] = $options['blog_content_event_post_' . $i]; } $event_args = array( 'post_type' => 'post', 'post__in' => ( array ) $post_ids, 'posts_per_page' => absint( $blog_count ), 'orderby' => 'post__in', 'ignore_sticky_posts' => true, ); break; case 'category': $cat_id = ! empty( $options['blog_content_event_section_category'] ) ? $options['blog_content_event_section_category'] : ''; $event_args = array( 'post_type' => 'post', 'posts_per_page' => absint( $blog_count ), 'cat' => absint( $cat_id ), 'ignore_sticky_posts' => true, ); break; case 'event': if ( class_exists( 'TP_Education' ) ) { $page_ids = array(); for ( $i = 1; $i <= $blog_event_count; $i++ ) { if ( ! empty( $options['blog_content_event_' . $i] ) ) $page_ids[] = $options['blog_content_event_' . $i]; } $event_args = array( 'post_type' => 'tp-event', 'post__in' => ( array ) $page_ids, 'posts_per_page' => absint( $blog_event_count ), 'orderby' => 'post__in', ); } break; case 'event-category': if ( class_exists( 'TP_Education' ) ) { $cat_id = ! empty( $options['blog_content_event_category'] ) ? $options['blog_content_event_category'] : ''; $event_args = array( 'post_type' => 'tp-event', 'posts_per_page' => absint( $blog_event_count ), 'tax_query' => array( array( 'taxonomy' => 'tp-event-category', 'field' => 'id', 'terms' => $cat_id, ) ), ); } break; default: break; } // Run The Loop. $event_query = new WP_Query( $event_args ); if ( $event_query->have_posts() ) : while ( $event_query->have_posts() ) : $event_query->the_post(); $event_post['id'] = get_the_id(); $event_post['title'] = get_the_title(); $event_post['url'] = get_the_permalink(); $event_post['excerpt'] = educollege_trim_content( 20 ); $event_post['image'] = has_post_thumbnail() ? get_the_post_thumbnail_url( get_the_id(), 'large' ) : ''; // Push to the main array. array_push( $content['event'], $event_post ); endwhile; endif; wp_reset_postdata(); } if ( ! empty( $content ) ) { $input = $content; } return $input; } endif; // blog section content details. add_filter( 'educollege_filter_blog_section_details', 'educollege_get_blog_section_details' ); if ( ! function_exists( 'educollege_render_blog_section' ) ) : /** * Start blog section * * @return string blog content * @since Educollege 1.0.0 * */ function educollege_render_blog_section( $content_details = array() ) { $options = educollege_get_theme_options(); $blog_content_type = $options['blog_content_type']; if ( empty( $content_details ) ) { return; } ?>