The Loop with Placeholders
I’m developing a new website with WordPress and I’ve run into an issue I haven’t had to deal with before. I’ve done some searching and I can’t seem to find anything related to my problem.
Basically I want to show 12 posts on the site index (which is simple). The difficult part is in cases where there are not 12 posts to display I want to display placeholders. So, say there are only 6 posts to show. I want to show those 6 posts first and then I want to echo out 6 placeholder posts that don’t have anything in them.
Basically the site I’m working on is a gallery type site. I want on the front page to always be a grid of 12 boxes (posts) even if there isn’t 12 posts to show. I have the grid worked out with CSS and I know how to loop through the posts but I don’t know how to do the placeholders part.
I assume it would have something to do with grabbing the posts and counting them and then echoing out enough placeholders to make the overall number of boxes 12. I’m just not sure how to do it really.
I hope I described this in a way that can be understood. Thanks in advance for any and all help with this matter.
- The topic ‘The Loop with Placeholders’ is closed to new replies.