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()?
- Get post ids from WP_Query?
- Some doubts about how the main query and the custom query works in this custom theme?
- How to query for most viewed posts and show top 5
- How to list some posts first in the loop based on post id
- Using OR conditions in meta_query for query_posts argument
- WP_Query – filter or directly?
- What is the most efficient way of querying posts based on visits and date for current day?
- Get posts by menu ID
- 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
- Custom query incorrectly returning everything [closed]
- WP Rest API v2 return posts with specific tag
- Perform query with meta_value date
- Meta Query with date and time on the same Day before given time
- get_the_title($postID) OR get_the_title()?
- How to support multiple search terms query within one process?
- How do I create my own nested meta_query using posts_where / posts_join?
- Best practice for multiple queries on page
- How to get any tag ID
- How to find out what “Blog pages show at most” is set to [duplicate]
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- What’s the point of the query_vars filter?
- Multiple instances of Featured Image Query
- Refine/Filter WP_Query Posts with jQuery or Ajax
- How do you Query posts with nothing in common?
- How to apply filter inside a single wp_query?
- When to add_filter() to Custom Query
- 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 with a meta value inside a given range
- How to use filter hook “the_posts” with a function that refers to $this?
- Store sticky post’s ids in a transient
- add_filter() depending on search term
- query_vars filter not working even though query string parameter is present
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Multiple loops without repeating content
- How can I filter by slug depending on language selection
- wp_query ‘s’, search filter with pagination is not working
- How to display an other custom post type in a different custom post type’s archive?
- How to increase load time of an archive/search page (WP_Query)
- How to alter local query, not main query [duplicate]
- How to filter a query by date in a shortcode?
- How can I allow sticky posts but cap the query to 1 post?
- Exclude All Posts Which Do Not Have A Tag Assigned
- Changing the default wp_search_stopwords
- Easy way to write complex queries in wordpress
- get_posts output always same post
- Is it possible to add an argument to a custom function added to a filter hook?
- Conditional operator OR not working with custom fields
- complex get_posts() query to select child pages
- Get posts that do not have the same tags as current
- Should I reset $wp_query?
- Posts query according to meta box date
- Get next/prev image/attachment in time with date query
- Max Posts and Memory Limit
- How to query for a page, get data, then query for child pages of that page
- Optimising WP_Query with ACF Fields
- meta_query weird behaviour, static int will work, but not user data
- Query post and sort by custom value calculated with custom field on cpt
- Filter products on category AND tag
- Query post ordered by meta value that show first post that contained a tag
- pre_user_query vs pre_get_posts
- How do I stop the same post showing multiple times in a archive?
- Problem with my loops
- get term objects and post objects in query
- How to set selected attribute on option after filter query?
- My entry results are not consistently alphabetized
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Issue generating custom filter for cpt admin columns
- query_posts() doesn’t seem to be called in my page
- Modify query to exclude certain ids and certain parents and its corresponding children
- Fetching $_POST from Page Template into functions.php
- How to order by datediff in WP loop?
- Custom query with post_class filter using current_post not working
- Optimising specific Query with ACF meta objects
- Filter WP_Query output before it is accessed (pre_get_posts)?
- query_posts with sorting on a custom datestamp
- Loop the posts between two dates selected using jquery datepicker
- Query Posts by date range with fixed beginning and end
- Exclude categories and subcategories in QueryLoop
- Edit WordPress loop, taxonomies, & filter
- Incorrect posts displayed on category page
- List categories using WP_Query
- WP Query – Show custom posts only if user contain some user meta
- Show number of posts AND number on current page (cannot make it work)
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)
- new WP_Query with order args – no more distinction between categories