In the following code you could add a class specifically based on the position in the loop:
<?php
/* Start the Loop */
$i = 1;
$class="first-class";
while ( have_posts() ) : the_post();
if($i % 4 == 0){
$class="second-class-".+$i;
}
echo '<div class="'.$class.'">'
get_template_part( 'template-parts/content', get_post_format() );
echo '</div>'
$i++;
endwhile;
?>
This is essentially a wrapper – it does not have to be a div, it could be a span – but it will count through the loop and change the wrapper class based on if the count in the loop is greater than 3 (first 4 posts 0-3). You then base your CSS off the wrapper class for greater specificity.
Related Posts:
- Display content from a specific category
- Exclude category on blog list page
- Changing next and previous post link text
- Blog Posts not showing title
- Adding parent pages to posts
- How do I get blog posts to appear within CMS?
- Automatic blog page with custom design [closed]
- How to set a certain Custom Template to a Single Blog Post
- Multiple Blog Pages
- “Blog pages show at most” in setting not working
- Display latest posts from a specific categories
- WordPress display page information rather than post
- How to put the WordPress blog into theme
- Why the blog posts is not showing?
- WP Blog Page Problems – Been stuck for a week
- Link post to blog from a static page
- Posts page template: How can I edit the markup for this?
- Page updates appear in Preview but not live version?
- Overwrite URL on blog posts
- Older entries link within a category page
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to implement default comment section in theme template?
- How to add paraent in Blog post URL in wordpress
- I have a website issue I am trying to resolve
- How to Change Order of Posts in Admin?
- How to Display Network Post Count?
- How to disable content pagination?
- How to add/assign or change featured image in post programmatically?
- WP-CLI Bulk delete posts from specific category
- Update all posts automatically when using post_meta
- Moving WordPress to new server: no posts found
- Exclude ALL posts from sub categories
- Post ids are incrementing by an unknown number?
- Can’t show comments count per post outside loop
- Redirect based on user post count
- Should our pages be posts?
- Allow role to delete posts but block him the wp-admin
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- Link post permalinks to subdirectory /post
- How do I add a custom body class to the admin area of a page?
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Show total author’s post views by posts post_meta
- Get the most repeated post contents from a search?
- pre_get_posts query between 2 dates (date stored in custom post meta)
- Why is my Blog Page ID == First Post ID?
- Get the number of posts shown in the current page
- How to have posts have a parent in permalink like site.com/blog/postname
- Unable to restore from backup – how to obtain old blog posts?
- Second comments section for one post/page
- 404 error on default post type and default taxonomy fronted page
- How i can limit period of post publication?
- Why Query is returning empty array?
- meta_value timestamp older than now
- Total number of posts in query (category/tag/author/search results/main page…)
- search blog posts by author first name and or last name
- Make loop inside slider divisible [closed]
- Very complex post query
- How to add convenient buttons for new custom post statuses
- Change the number of excerpts displayed in search results layout
- Echo Text If User Is Logged in But NOT the Author of post
- Database hacked – random posts are modified
- Getting Whitescreen when publishing a post [closed]
- How to display post list in a table layout (multiple queries in single loop)
- add div after image in post [closed]
- How do I link a Post Type to a Template in Masterplan?
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- Get content from WordPress posts in Boostrap modal window – Javascript side?
- How can my plugin display a populated new post window
- Where is the “Posts”/”Blog” template?
- How to get posts ordered by using their categories?
- How to get value in radio input in post meta box?
- ACF date picker to trigger category change
- How to insert custom text after H1 to all my blog posts?
- wordpress admin missing Posts button
- Set post title font size automatically according to number of words in post title
- SQL query: select duplicate posts – but using duplicate meta [duplicate]
- Sync All Post Type Tag
- post and page and custom post type
- How can I use query_posts to loop through posts and construct my own content?
- How to make an image appear as a thumbnail in the blog post?
- How can i take all ids from untrash_post action?
- Permalink base only for posts
- If I moved the location of my generic “posts” page, do I need to change the slugs for all of the individual posts?
- Not display post meta if empty
- issue in wordpress auto delete post and redirect to another 1
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Adding div to WordPress page content
- Loop doesn’t display posts. It displays a link to the home page instead
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Super post cleaner, could this be category specific?
- How to organise post by category and date
- Show post if in category
- How to display custom content in post with category XXX
- Get current post’s child page?
- How to include Related Posts in WP RSS feed
- retrieve post slug by post_tags taxonomy
- Show all posts in category
- Creating a new Sortable Column in WordPress Admin
- Hide the contents for specific post
- Display post structure in function