I think you should add a css class and in your loop, put a $i
and let $i
run, if $i == 2
then you add the css class attribute to that sticky post.
$i = 0;
while( have_posts() ):
the_post();
$i++;
if($i == 2):
$css_class="top-sticky";
else:
$css_class="";
endif;
endwhile;
wp_reset_postdata();
Related Posts:
- Remove the Homepage Query
- Pagination not working on home page
- is_home, and is_front_page conditional problem
- Apply styling only to first page sticky posts
- How to retrieve “sticky” post outside the “loop”?
- Better way to display posts from specific categories, in a grid layout
- 3 Posts in Loop, Show Stickies First
- Move sticky posts down in main loop
- Recent posts on a static home page
- sticky post in custom loop
- Blog page Server error 500 with stick post loop in query.php
- Showing sticky posts with get_posts()
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- Exclude duplicated $sticky post from combined loop content
- Exclude first post (sticky or not) from the loop using query_posts()
- Loop for sticky posts
- How do I put my frontpage featured image in a page template for home.php?
- Display post formats differently on index.php (loop in function)
- WordPress loop not working only on home page, works on all other pages
- WP_Query is only looping home page, not pages
- Skip 5 latest post while paging?
- Custom Query with Sticky Posts
- Homepage Loop Somehow Breaks Styling Of Post Grid
- Echo Most Recent Sticky Post in Loop?
- Insert/sticky multiple posts in multiple positions
- 2 loops in blog homepage
- Home page loop with pagination problem
- I make sticky post for my archive page for custom post type with ACF field and loop is not working
- Get date of last update outside of loop
- WordPress category & taxonomy loop with pagination
- Changing behavior of the loop twice in one page
- Displaying child page content of a certain parent
- Pagination adding extra posts only on page 2
- If Loop has odd number of posts on last page Custom style for last post in it
- Custom page template
- Get posts that matches specific terms of multiple custom taxonomies
- How can I use get_permalink() outside the loop?
- Two loops by pre_get_post on same page
- How to check for specific content in comments in the loop
- Problem the_permalink
- Sort Posts By Category?
- Can’t access login screen, wp-login.php 404’s
- Create static front-page with 3-5 recent posts
- get latest 5 posts and a specific post and sort in a specific order
- How to use current_post to open a new unordered list every five posts
- Pagination for multiple loops
- Infinite Scroll on a loop?
- Post classes in the loop are being changed in certain themes
- “Call to a member function have_posts() on array” error on have_posts();
- How to exclude or filter password protected posts when using next_post_link() previous_post_link
- How to remove only the latest sticky post from the loop
- Get the image src and href data from posts
- Sending mail not working correctly
- Call wp-blog-header.php header without performing a wp_query
- How to output thumbnail twice in a loop
- Frontpage pagination by week
- Integrating WordPress with Your Website
- Multiple instances of Featured Image Thumbnail As A Background On Homepage
- Altering “posts_per_page” for defaut loop
- Why doesn’t ‘continue’ work in page?
- Display more than 10 posts on author.php file
- Accessing the Posts page Content
- Display all categories as plain text
- Query post & loop problem.
- Exclude current post ID from loop in sidepbar.php
- loop inside a loop : search for posts in the same category
- How do i create a loop that list and divide posts into months?
- Forcing page to top of the list when using get_pages
- How to declare a variable in a loop and make it available in the template file
- How to display fields from the loop in two separate divs
- How to use single.php output in function.php
- Duplicate posts on archive page
- Build a Page which shows the Oldest Post with specific Custom Field Value
- WordPress multiple loops with default pagination
- Loop random posts and display odd and even based on two alternating meta values?
- WordPress + Isotope: how to give different widths to each entry?
- hide woocommerce tab if empty
- How to manually define the primary loop
- Url outside the loop
- How to filter get previous post function by meta value DESC and post date DESC?
- Style first 3 posts differently and use a 2nd loop to get rest of posts / offset and pagination broken
- Posts Per Page is Not Returning Correct Number
- Cant pull in featured Image
- Link Button url count php and wordpress
- Posts are being displayed from old to new, in ascending order
- Set loop format & have a loop inside other one
- Need a conditional to test if title of parent page matches title of child page
- Query counting excluded category on paged loop
- Using shortcode within shortcode with dynamic variable
- modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)
- Display articles related to a custom field on a page
- Why is my pagination showing up?
- How to create an identical second loop for attachments?
- Randomly Display One Image From a 10-Image For Loop
- An action that runs after each post in the loop on index/archive page?
- Getting post id in for loop
- Multiple loop with pagination in same page
- Why did my most recent article fall behind an older one on my site?
- wp_mail function not working in user query loop
- How to set and retrieve cookies while in the loop