Archived topic
Query Loop - No Results Found
5 replies · Started by Zoltan on February 6, 2023
Hi, I'm following a custom archive template tutorial. I can't figure out why my query loop is bringing in "No Results Found."
I am using CPT UI and created a custom post called Services. Show in Rest API: True, Has Archive: True. The Services Archive page has 4 posts visible.
Then I created a block element named Archive, type: Loop Template, location: Services Archive.
Then when I add in a GB Query Loop element, it returns "No Results Found" instead of an editable block.
I tried the Query Loop on the Wordpress blog posts archive and it worked. It just doesn't work on my Custom Post archive.
I am new to CPT UI and GeneratePress. Any help would be appreciated. Thanks
Hi Zoltan,
Is there anything showing on the services archive front end?
Can you link us to the services archive for us to take a look?
When I set the Location of the block, the Services Archive front end loses its 4 posts.
Is the element called archive? If so, you've chosen the post post type not the services post type for the query loop:
https://www.screencast.com/t/jNaz5jZVCu
Thanks! It works now.
I think my problem was being caused by turning on "Inherit Query From Template." When I toggled that on, the post type selector disappeared, and I wasn't able to choose the correct post type.
If I leave the "Inherit Query..." off, then I can select services post type like you suggested.
Anyways, thanks again for the help, I appreciate it :)
When the inherit query from template option is enabled, it uses the post post type, as you don't have any published posts, so it returns no posts found :)