0

I've seen that many sites have a dedicated page for a sitemap, not just an .xml file.

For example, https://www.casinos.de/sitemap/ They're using Yoast SEO and sitemap.xml is also available, but how can you embed the whole sitemap in a page like this?

Is there a function or just a file_get_contents()?

1
  • 1
    file_get_contents() won’t work, as using that on an XML file will not create a list of links. WordPress has wp_list_pages() which will create a list of pages, but only pages, and that’s all. Whether Yoast has this feature is something you would need to ask its developer. Jan 6, 2022 at 10:41

1 Answer 1

1

You can fetch all the different post_types you have by using get_post_types(). Then you can loop through all posts of each post_types and echo all these posts (title + link). That way you have the freedom of formatting your sitemap the way you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.