Post loops

I’m trying to duplicate the building wordpress theme from the Blocs Website Builder videos and am having trouble. In my theme I want blogs posts to appear in a row at the bottom of the home page. I would like 4 thumbnails in a row with a heading underneath and a short caption. I’ve placed a 4 column structure bloc under my main bloc on the page as per the video and set the wordpress loop to post. I then inserted an image and set the data source to featured image and a heading set to post title .

I’ve refreshed the live data to my test wordpress site, where I have two posts. When I press preview I get 10 thumbnails. The first one is an empty image and the title ‘media post’ then my two posts images with their correct titles and then 7 other place holder images titled media post (see below).

I don’t understand why this is happening. My wordpress media library has two items in it (images for my two posts) and that’s it. Why is the blocs preview showing 10 items when the initial bloc structure was 4 columns?

Any help would be appreciated. thanks

Did you remove all but one of the columns in the loop.

Yes. I’ve since rooted around with in the wordpress site and found that even though I deleted all of my media except for the two images I’m using there was still a media post in my posts folder. I’ve deleted that post and have purged my cache within wordpress and now the first post (ie, the media one has gone) but I’m still ending up with 10 posts on the blocs preview. I get the latest post then the my first post and then 8 copies of the latest post minus the images.

And you only have 2 posts on the Wordpress install?

yes. here’s a screenshot.

.

I’ve also quit and restarted blocs thinking that may purge the problem but it did not.

update: I deleted my wordpress site and reinstalled wordpress with the basic bootstrap theme. I then created two pages in wordpress: home and a blog page called posts. In blocs I have two pages: one called ‘Home’ and one called ‘single’ (from the blocs ‘create new page’ wordpress page names). On the blocs ‘single’ page, I followed the instructions from the video again (4 column bloc, delete 3 columns, assign wordpress loop to post, add image and assign source to featured image and add and assign header source to title-post/page) and I still get 10 posts. I then put in 11 dummy posts in wordpress. In the blocs preview it publishes the posts in order (latest to oldest) but only 10 at a time, meaning that the first (ie oldest post) does not appear.

1 Like

Would you be ok with sending me a copy of the project file please?

Here’s a trimmed down version but I’m still getting the same result.Test.bloc (383.0 KB)

I think I know what the problem was. I was not exporting the wp theme and viewing on the server. That is I was looking at the blocs preview not the word press preview. I have since exported the theme, uploaded it to the server and view the posts and it looks ok.

Also I needed to change the reading settings in wp to 4 posts.

(I find the tutorials quickly mention important steps and therefore are easy to miss. It would be nice if they were a little clearer about the importance of certain steps.)

1 Like

Thanks for the feedback.

Now you’ve set your Wordpress site post loop number in the WP admin, I think Blocs preview will also respect that count now too.

It looks to me in preview if the amount of posts is less than the quantity specified in the wp admin settings, in blocs it will display the amount specified in the settings with the first post repeated.