Hi,
i'd like to generate an xml sitemap with content filtered by a view.
Can you help me please?
Hello, there's nothing built-in to Views that will help you produce a valid XML document automatically, but if you show me exactly what you want to produce I'll see if there's a way to create some matching output. Can you share a link to the XML document you want to create so I can see the structure?
Hi Christian,
i'd need a sitemap to pass some posts to wp-rocket plugin to preload the cache of certain urls.
I would pass the xml sitemap with two custom post types:
- Events - Filtered by future events
- Locations
I can send more than one sitemap to the plugin.
This is a sitemap example on my website:
hidden link
Here is the source code of that link for reference:
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="<em><u>hidden link</u></em>"?><!-- sitemap-generator-url="<em><u>hidden link</u></em>" sitemap-generator-version="4.1.0" -->
<!-- generated-on="23 June 2020 14:21" -->
<urlset xmlns:xsi="<em><u>hidden link</u></em>" xsi:schemaLocation="<em><u>hidden link</u></em> <em><u>hidden link</u></em>" xmlns="<em><u>hidden link</u></em>"> <url>
<loc><em><u>hidden link</u></em>;
<lastmod>2019-12-27T12:48:27+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc><em><u>hidden link</u></em>;
<lastmod>2019-12-20T11:20:50+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc><em><u>hidden link</u></em>;
<lastmod>2019-12-20T11:24:07+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc><em><u>hidden link</u></em>;
<lastmod>2019-12-11T22:16:43+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc><em><u>hidden link</u></em>;
<lastmod>2019-12-07T16:29:26+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>
The problem I see is that the output of Views must be displayed within the WordPress site. So the output of a View can be whatever data you want, but it will be displayed inside the website's header and footer with the standard WordPress menu and everything around it. Is that what you want?
Hi Christian,
i taked a while to find the post i remember you helped me in the past:
https://toolset.com/forums/topic/load-different-layouts-via-php-conditionally/#post-597813
I think the solution could be similar to this thank to ob_start()
Yes but Toolset only works within the context of a WordPress site. I don't know how this would help you output an XML document without the full WordPress website wrapped around it. Toolset isn't designed to work outside of WordPress, and it's not designed to generate or write to external files on the server. What about WordPress's RSS feed XML documents, can you submit those instead? They are created automatically for each custom post type like https://yoursite.com/cpt-slug/feed
I have a view with next events.
I'd need to have an xml with just with that data.
I don't know if an xml is valid also if within the website.
I don't know if an xml is valid also if within the website.
Maybe you should test that before you waste time trying to build it with Views.