Skip Navigation

[Resolved] Search Results: display sitemap if "no items found"

This support ticket is created 2 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.07 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by webD-3 2 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2411143

I'm using the Block Editor for my Search Results Archive.

If there are no results, I'd like to follow the "No Items Found" text with a sitemap (shortcode: [simple-sitemap]) to aid the user.

Is there a place I can insert this shortcode so that it renders? I've tried putting it in a couple difference places in the WordPress Archive but it apparently renders the sitemap first, and then searches the sitemap output.

What I'm seeking is that, if there are no results, the sitemap is then displayed.

I'm glad to provide more details if I am not being descriptive enough. Thank you for your help.

#2411147

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2022-07-04 at 1.17.43 PM.png

Hello,

Thank you for getting in touch.

If you highlight the archive loop then you should get the Loop Template section in the block options. See Screenshot.

This is where you can add your sitemap shortcode.

Thanks,
Shane

#2411171

Shane, thank you.

That is the first place I tried, and when it didn't work I tried other spots in the template that also didn't work.

When I place the shortcode in that area - whether inside the [wpml-string] shortcode or outside it, it seems like it's parsing that shortcode first. I get a "Pages Not Found" output from Simple Sitemap - obviously if the search term isn't found by the site search it's not going to be a page name in the sitemap.

What I have chosen to do is to just add a hyperlink to the Sitemap page. Should the user get no results and be interested in viewing the sitemap rather than searching again, they can just click this link and be directed there. I think that should be good enough in this case.

Thank you for your prompt assistance!

#2411173

My issue is resolved now. Thank you!