<?php if( have_posts() ) : ?>
<?php $count = 0; ?>
<?php while( have_posts() ) : the_post(); ?>
<?php
global $count;
$col="col-lg-6";
if($count%3 == 0) {
$col="col-lg-12";
} else {
$col="col-lg-6";
}
$count++;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $col ); ?>>
[...]
[...]
[...]
</article>
<?php endwhile; ?>
<?php endif; ?>
Related Posts:
- Counting the posts of a custom WordPress loop (WP_Query)?
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Is there any difference between the_title() and echo get_the_title()?
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Cleanest Way to Select Every Second Element in a Loop?
- Pagination not working on home page
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Get ID of a page containing secondary loop in content
- is_home, and is_front_page conditional problem
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Why do themes have `while( have_posts() )` in templates like single.php?
- What is best way passing variables to theme templates and using them different places like widgets?
- Apply styling only to first page sticky posts
- Exclude category by slug for for each loop
- Too many nested wp_query loops in this hypothetical query?
- pop-up lighbox with AJAX
- WordPress Loop Through Particular Pages
- Load comments per post on click with AJAX
- The main Loop is not starting in a custom blog template page
- WordPress Loop – Style rows of posts differently
- connect last post with first post
- Chopping up a large ajax request of around 200 posts [closed]
- Custom loop with conditional statement to separate each terms
- taxonomy tags 404 to custom post types
- Breaking the loop?
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- woocommerce stored variable
- Query last updated posts (posts updated in the last 24 hours)
- A smarter way to display multiple loops inside a page template
- Publish Categories for a particular Author on a given Post
- How to print out menu names in the foreach loop?
- How do I style the first two posts of a loop
- Do I need to use The Loop on pages?
- How to get the role id from the role name?
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- Is wp_reset_postdata() redundant after the main loop?
- Exclude first post (sticky or not) from the loop using query_posts()
- While loop with bootstrap [closed]
- Need to add class to first element in a foreach loop
- Scrolling Posts with Ajax
- Sort posts by first letter in the title, not by first number
- How to create a multidimensional array with multiple loops
- how to replace get_template_part(‘loop’,’tag’) with explicit styled version?
- Get paged outside of loop?
- How to create custom popup in shop page on every loop products?
- Show scheduled posts in loop (but don’t link to them)?
- How to get a count of all posts in foreach loop and split into fourths
- Getting posts link in WordPress
- Loop through an array inside a class using foreach [closed]
- using wp_get_attachment_image_src in foreach loop
- Grabbed Post ID under WP loop, but still couldn’t Print Post title
- How to loop through yoast primary categories? [closed]
- How to separate posts loop in to two columns? [duplicate]
- WordPress get post thumbnail url
- query_posts clarification needed
- Blank content php code not parsing advanced custom fields gallery add-on [closed]
- Three Column Loop
- Can’t get the previous and next posts permalink
- Adding first and last classes to three column layout in Bones boilerplate
- Modifying a Loop to Show More
- Does search.php autofilter The Loop?
- “the_excerpt” in loop just keeps repeating first post?
- wpdb inside foreach loop only returns first result – 2 other similar cases found [closed]
- Using jQuery .after inside loop
- Add 2 values to post__not_in
- Page Navigation Outside the Loop
- How to loop specific Category menu from archive page?
- How can I pass additional params to a shortcode while in a loop?
- Add all category as classes in foreach loop
- Exclude posts from loop by term
- How to display a loop of custom post types in columns
- Excerpts not showing on main page
- dispaly all hierarchical post types from a taxonomy
- WordPress Modal showing posts not working properly
- Query posts and display all dates in repeater field in chronological order
- Multiple loops in set intervals with code in between
- Loop shows post 5 times in a query
- Attachment Metadata inside of Loop
- Modify widget to output posts in custom order
- Make custom WordPress comments list
- Template included with plugin doesn’t return all posts for custom taxonomy
- Limit article to 100 characters. Can’t use the_excerpt…
- Return only content in excerpt field in loop
- Adding pagination to WP_Query [duplicate]
- Insert/sticky multiple posts in multiple positions
- This webpage has a redirect loop issue with SSL page
- Buddypress Group Activity Loop Filter activity type [closed]
- Stuck with conflicting loops on page template
- Change the way wordpress outputs images or image galleries
- How can I access ‘key’ and ‘value’ from an array in a for loop?
- How to get current page id and compare it to looped pages inside the same page?
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- posts_nav_link() not working on index.php
- How to add custom HTML markup and classes to the_content()?
- $do_not_duplicate is not working in genesis theme
- Loop displays current page
- Hook in the loop after the first post