Yes, it is quite simple, you just need to work in PHP.
Consider you have 36 posts in a loop.
$div_html_1 = '';
$div_html_2 = '';
$div_html_3 = '';
$div_html_4 = '';
$div_html_5 = '';
$div_html_6 = '';
if ( have_posts() ) {
while ( have_posts() ) {
if( category of post == division 1 ) {
$div_html_1 .= "Your HTML here";
} elseif( category of post == division 2 ) {
$div_html_2 .= "Your HTML here";
}
and so on....
}
}
And in the layout, your code would be like,
<div id="prefix_div_one">
<?php echo $div_html_1; ?>
</div>
<div id="prefix_div_two">
<?php echo $div_html_2; ?>
</div>
and so on...
Related Posts:
- Woocommerce, recognize the loop of related products
- Using Advanced Custom Fields to create a per page slider
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- For each loop will not append to the_content hook
- How can I fetch loop of post titles via AJAX?
- WordPress and event-driven programming – what is it about?
- get product attributes for current product and store it in a variable
- How to remove a metabox from menu editor page?
- How to add active class to custom menu using while loop and wp_list_pages
- MySQL query performed 4 times inside loop
- Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin – Adding to “Thoughts” Theme
- Using an Image Slider twice on the same page
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Custom Loop through category menu to include sub categories
- Insert all post IDs in new database table
- How do I display the function the_content in this loop?
- How to get to a specific position in wp_query?
- Facebook “like” open graph meta in header.php
- Custom excerpt function re-factoring
- How can I show the post thumbnail from the most recent of a certain post type, in widget?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- wp_loaded hook block script enquequing
- ACF page while loop breaks footer while loop
- Split loop into two columns, how to favor one side over the other
- hook that when page is starting to load
- How to change home or site url using action hooks or filter?
- Dynamic Stylesheet loads but doesn’t finish
- Filter Select results based on selection
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Why ajax doesn’t work on certain wordpress hooks?
- How to add an arrow to menu items has submenus
- How can I add extra word in permalink when someone click download button?
- Don’t insert if permalink is the same?
- Increase offset while looping
- remove post that has no content
- Can we count the WordPress Loop
- Get post id within comments loop
- Syntax error when I try to insert my loop into an unordered list? [closed]
- Custom Pagination is Broken
- How to overwrite orderby with add_query_var
- How to catch wordpress post ID when it’s published
- get_the_ID() in the footer returns wrong value
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How can I hook into the wp_mail function used by BackWPup?
- How to get current post category details inside “loop”?
- WP_Query multiple post results
- Convert Featured products loop into Recent products loop?
- Echoing a CSS class based on category of post in a list
- Posts are not looping through correctly
- Limit tags shown in post
- Create Div Wrapper On 3rd Iteration Or When Query Loop Items Run Out
- Php code error in wordpress if else statements [closed]
- How to pass hook variable to function?
- pagination broken – clicking next displays “page not found”
- Add class to every other posts using get_posts
- Wp Query : Order by distance lat,lon
- How to Add a cutsom slug to my custom author role
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- Give ID to divs inside the loop
- Display articles with a different template in the home page | Solved |
- add another variable to php function
- How to output the taxonomies that are assigned to each custom post?
- Use wp_head hook on template page
- How to edit post meta data before publishing the post it self wordpress?
- Looping through dummy posts and showing them in the main index.php
- Get original value in save_post action hooka
- Custom Loop.php having a loop inside a loop
- get Woocommerce product format json for WP_Query
- ACF – Get ID of relationship field in flexible content
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- WordPress Ajax filter: Create two loops for different output styles?
- How to display sticky post always at the top (before regular post) in wordpress?
- Return to the beginning of the results of a for loop
- How to count posts posts if they are in a separate content page?
- Adding PHP to an if else loop
- Hook into all password resets in WordPress and get password before hashing?
- Thumbnail wouldn’t scale to size properly
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Why transition_post_type hook is called twice for the same post?
- Add div after every 4 posts then every 2 posts for a responsive loop
- Retrieving specific images from Media Library
- Add post class in custom loop (WP_QUERY)
- Custom Taxonomy Link Text Echo Name Not Slug
- divide custom field values in div every two values
- calling a function from a class in your template
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- why is this content-template not showing any of my blog-entries?
- Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
- Custom single.php files for different post formats
- How to call the_author_meta and make it work?
- Troubleshooting “loopback requests that take too long”
- Change Checkout “Place Order” text if cart has a specific product
- Excerpt all post content Content Same Size without word cutting off
- Help with if/else loop [closed]
- understanding wp_next_scheduled
- Guests comment form – prevent duplicate email addresses
- How do I exclude the current post from the upcoming post query