The problem lies in this line:
$rows[$count] = $rows[$count] . '<div class="col-sm-3">' . '<h4>'.strtoupper(get_the_title()[0]).'</h4>' .'<div class="post-title">'. '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>' . '</div></div>';
As I understand your code correctly, it should append another column item to given row.
But it doesn’t do it – it overwrites the content of given row with current column.
So it should look like this (.=
instead of =
):
$rows[$count] .= $rows[$count] . '<div class="col-sm-3">' . '<h4>'.strtoupper(get_the_title()[0]).'</h4>' .'<div class="post-title">'. '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>' . '</div></div>';
PS. You wrote that you want 3 columns, but in your code you divide by 4 – but maybe that’s just a typo.
Related Posts:
- WordPress loop add heading before first of type
- Fetch loop of custom post types with AJAX
- Custom post types not displaying per category
- Only show current category post
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Error in WP Query. If variable is empty it is displaying previous post value
- Strange behavior on WP_query
- Looping through custom taxonomy in one template
- get_post_meta for Custom Post Type ( CPT )
- WordPress loop, show only one post per custom field
- How to return custom posts in loop?
- All custom posts are not showing up
- WordPress query posts by custom post type not workng
- How to keep a CPT stick to specific position?
- How to show Y number of custom posts after every X normal posts?
- How To Loop Through list with Custom Post Types
- Custom post type with custom taxonomy permalinks
- custom post type loop
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- Listing Custom Post Post from certain category
- How to check if meta box value is false for all posts then do something based on that
- Tricky Custom post loop
- Loop posts in a table ordered by a custom field value
- Is it possible to add query parameters on the archive page?
- Custom Loop Event Page
- Custom taxonomy page template
- Multiple loops for custom post type to spread data across rows
- Cant insert wrapper div into index.php
- Pagination on custom post types
- Custom Post Type + Category archive
- Pagination in custom post type page template
- Loop with Custom Post Type and Taxonomies
- How to get past and upcoming post by defining date in custom field?
- display news with pictures 3 small and one large (loop)
- Loop multiple taxonomy in custom post
- $post breaking container loop
- How to query all custom posts of a certain type and checking what category they have
- Simple term-archive-linked Taxonomy Entry output
- Custom post type archive pagination with HTML5Blank theme?
- Post data in separate divs with incrementing class using WP_Query
- Redirection loop error after login from a custom post type post
- How to create content automatically when a post is published?
- WordPress Custom Post Type and sort by Tags
- WordPress loop for multiple custom post types
- Load different template for CPT (in loop) in my plugin?
- Custom Post Type Order Index Loop
- After rewriting post type’s URL, the number of queries has increased dramatically
- How to loop custom post type posts by author?
- Display posts from category in page
- How can I pull information from my loop and divide them seperately?
- Multiple Queries and Loops within CPT Archive
- Posts without featured image using other post’s featured image
- WordPress nested loop not working
- Order by custom field attribute
- Get result from Custom Field in Custom Post type
- Display Custom Taxonomy of custom post type
- Pagination not working with custom loop
- Fallback if statement based on the number filtered from it
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Turn post into simple slideshow
- List a custom post type’s posts ordered by nested custom taxonomy
- Sorting custom post types by taxonomy (So close)
- Inserting random posts
- Nested loop called with shortcode duplicating the content above the main loop
- Create custom post order (with custom post type meta)
- Create shortcode for list of custom post titles with custom fields alongside
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- Looping taxonomy in taxonomy?
- next_posts_link returns same content of 1st page
- Custom Loop and Standard Blog Loop Issue
- Listing custom post type items from a couple of custom taxonomies
- Pagination not working with custom loop
- Custom loop won’t work, can’t find problem
- Custom post-type’s pagination not working in category.php
- Pulling in a particular post into a single page based on the post id passed into the code
- Noob Loop Question
- Categories and page filtering with pre_get_posts
- Display multiple custom post type lists on homepage – multiple loops
- Loop through multiple custom taxonomy terms and display posts for a custom post type
- Split custom post list into two columns
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- loop through custom post-type with two meta_keys
- Custom Post Types and 404 Pages
- Query Custom Post Type by Tag
- Loops running into each other
- Display by tag from different post types
- How to Create a Frontend Html-list Editable in the Backend?
- Fourth page of custom post type archive page does not exist
- Loop to pull content from parent element in custom post type [duplicate]
- Loop doesn’t work in single-product.php page but works at normal page
- Catergory args causing loop not to show
- add a “list” into add meta box : problem
- why get_post_meta is returning 0?
- How do I filter a custom post type loop by a field?
- Post_type doesn’t work for widgets?
- the_content() stop images being pulled through