Skip Navigation

[Closed] Generate xml content from a view

This support ticket is created 4 years, 6 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Christian Cox 4 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1671883

Hi,
i'd like to generate an xml sitemap with content filtered by a view.
Can you help me please?

#1672497

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?

#1672787
Schermata 2020-06-23 alle 01.40.25.png

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

#1673619

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?

#1675633

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()

#1676613

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

#1676631

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.

#1677123

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.

The topic ‘[Closed] Generate xml content from a view’ is closed to new replies.