I think you can simply use:
post_class( 0 === $featured_posts->current_post ? 'first' : '' );
to add the first class directly within your template code, instead of applying the post_class
filter.
Related Posts:
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Bypass “supress_filters” in WP Query
- Filter Custom Taxonomy Posts
- Filter post query to only show direct children of category
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- filter posts by meta key with pagination
- Sorting query_posts() with a complex orderby filter
- query post based on comparison
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- Get post ids from WP_Query?
- Nested meta_query with multiple relation keys
- Some doubts about how the main query and the custom query works in this custom theme?
- Wp get all the sub pages of the parent using wp query
- Use REGEXP in WP_Query meta_query key
- How to query for most viewed posts and show top 5
- WP Query where title begins with a specific letter
- WP_Query vs get_posts
- How to list some posts first in the loop based on post id
- Whats the difference between post_limits and pre_get_posts?
- How to add taxonomy filter on the query fly?
- Using OR conditions in meta_query for query_posts argument
- Query Posts in a Predefined Order
- WP_Query – filter or directly?
- Order posts by ID in the given order
- What is the most efficient way of querying posts based on visits and date for current day?
- Query Multiple Post types each with own meta query
- Get posts by menu ID
- Get the number of posts from the current page results
- Changing Posts Per Page and offset with pre_get_posts
- ajax category filter
- WordPress Custom Query to show posts from last x years
- How to order posts tag by tag?
- Overriding The Loop with filter or hook
- Query Custom Meta Value with Increment
- Custom query incorrectly returning everything [closed]
- WP Rest API v2 return posts with specific tag
- How to know which one is the main query?
- Get posts by meta data OR title
- How to filter sql only for a specific post type
- Perform query with meta_value date
- Using is_main_query to select custom post type on certain page
- WP_Query ordered by custom field that is a date string?
- get query’s query string
- Meta Query with date and time on the same Day before given time
- Ignore a filter on the media library
- get_the_title($postID) OR get_the_title()?
- Display Posts by modifying the where clause only for my query
- How to support multiple search terms query within one process?
- How do I create my own nested meta_query using posts_where / posts_join?
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- Best practice for multiple queries on page
- How to Get All Posts but the Private ones?
- How to get any tag ID
- How to query ‘posts_per_page’ to display a different blog posts index template?
- How to find out what “Blog pages show at most” is set to [duplicate]
- Which filter/action hook gets triggered after a query has been performed?
- Multiple search queries on one page
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Pass the same object to multiple widgets in a template with one query
- Retrieve or Query Pages by ID
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- Removing posts from the returned wp_query. Cannot use object of type WP_Query as array
- WP query exclude post within the last month / only show over 1 month old
- WordPress query for most recent posts from multiple categories
- How do you query wordpress posts using a math formula between multiple meta field values?
- How add a custom posttype name using ACF field to a query post array
- Too many posts cause slow load when paginating
- What’s the point of the query_vars filter?
- Page navigation doesn’t show when query category
- Multiple instances of Featured Image Query
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Use ‘parse_query’ filter to show posts that from multiple criteria
- How can I pick a single post from the latest 3?
- 2 loops on page – one with orderby rand second orderby date
- How do you Query posts with nothing in common?
- Query post with meta_query where date is not in future
- Next/Prev posts on same page
- How to apply filter inside a single wp_query?
- What is considered a default query for the request filter?
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- Modifying the Search Results
- When to add_filter() to Custom Query
- Custom category search box for WordPress
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Order by custom table and multiplication
- Query total number of posts
- Query with custom taxonomy not working
- Query posts by specific word on title
- How to add post_distinct filter to WP_Comment_Query?
- How to query a custom post type with a taxonomy filter but display post type archive page?
- WP_Query last five posts, simply ordered by meta_value
- Query with a meta value inside a given range
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- How to use filter hook “the_posts” with a function that refers to $this?
- How to create a WordPress Post Filter that users can use to filter posts by year?
- WP_Query “OR”: Find posts by ID, Name or Post Title?
- Store sticky post’s ids in a transient
- Five posts from a category in footer