Site logo

Archived topic

Block Loop Element on Archive Page Only Displays One Item

19 replies · Started by Samuel on March 29, 2023

Viewing posts 16–20 of 20

Or to say it differently is there any way to insert/modify dynamic data in a QueryLoop on an archive page other than the standard built in dynamic data sources? Is there any way to extend those? I thought shortcodes would be an easy way to do it since it works perfectly on archive loops in general. But apparently the QueryLoop works different than the normal archive loop.

Shortcodes don't work well with query loop, it's a WP thing, you need to use the render_block filter to do_shortcode.

for example, if there is a link in one ACF field the title needs to be a link.

You can have different data source for the text and the link, have you tried that?

Great suggestion, but in my case I have to calculate if a link was supplied. Looks like I simply have to use the renderblock filter. I was just surprised that shortcodes which work on a normal archive page don't work if you use the QueryLoop.

I've solved the problem for new using the render_block filter. Thank you for pointing that out.

but in my case I have to calculate if a link was supplied.

If the link doesn't exist, GB will generate no link for the title, so you don't need to calculate that if this is the case.

I was just surprised that shortcodes which work on a normal archive page don’t work if you use the QueryLoop.

Yes, we can't get around it as it's a WP limitation.

But glad you've sorted it :)

This archived topic is closed to new replies.