$WP_Query: How to display excerpt on first post only

Pull it out of the content-part. That would be the easiest. <section id=”featured”> <?php // Start custom loop $args = array( ‘post_type’ => ‘project’, ‘posts_per_page’ => 5, ); $featured_query = new WP_Query( $args ); while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?> <article class=”project”> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( ‘post-thumbnail’, array( ‘class’ => ‘featured’ … Read more

Pausing and Resuming WP_Query results

I think the best way to approach this might be to run your WP_Query just one time, but then access the stored query results three times to output each wanted set of data. This will save you from using multiple DB queries, and by using three separate loops, you can still add a parent div … Read more

Limit length of first excerpt in the loop

To determine where you are inside the loop in this filter, you will have to access the global main query. Like this: add_filter (‘excerpt_length’, ‘wpse268679_custom_excerpt_length’); function wpse268679_custom_excerpt_length ($length) { // access main query global $wp_query; // do this only for the main loop and the first post in the query if (is_main_query() && ($wp_query->current_post == … Read more