Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Automated XML export from custom post type and custom fields WordPress

  • SOLVED

Hello,

I was wondering whether it is possible to use export_wp function to create an automated (let`s say on a daily basis) XML from custom post type and custom fields that looks like this one:

[[LINK href="http://nekretnine-hrvatska.hr/sync.xml"]][[/LINK]]

If it`s possible, I need someone that can do it, and I need a quote, ASAP!

Thanks!

Answers (2)

2014-09-09

Dbranes answers:

Here's an example:

/**
* Export XML for a custom post type 'cpt'
*
* @see http://www.wpquestions.com/question/showChrono/id/9830
*/
add_action( 'template_redirect',
function()
{
$secret = filter_input( INPUT_GET, 'secret', FILTER_SANITIZE_STRING );

if( '123' == $secret )
{
require_once( ABSPATH . 'wp-admin/includes/export.php' );
$args = array( 'content' => 'cpt' ); // custom post type cpt
export_wp( $args );
exit();
}
}
);


where you can change custom post type 'cpt' and the secret '123' to your needs.

You can get fetch the XML via:

example.com/?secret=123



wpenthusiast comments:

@Dbranes, please take a look at the link, it`s really important as the XML file I need is quite specific. It`s a feed for real estate listing created from custom post type and custom fields.

http://nekretnine-hrvatska.hr/sync.xml


Dbranes comments:

This is way beyond <em>export_wp()</em> capability.

You need a custom solution for this type of XML.

At first glance, it might even take some hours of work to complete this.

$1 is not going to get you far, I'm afraid ;-)


wpenthusiast comments:

Dbranes,

like I wrote in my first post, I know $1 won`t get me far, it won`t get me anywhere, this is why I wrote I`m looking for a quote. I wanted to know whether it`s possible by using export_wp. It doesn`t have to be done with export_wp.

What`s more, I need someone who can create this sort of XML file, and I`d like to hire someone who know WP, not just someone that know PHP/MySQL/XML. Of course, not for a dollar :-)


Dbranes comments:

ahh, sorry, I missed that part of your question that you were looking for a quote, my bad ;-)


wpenthusiast comments:

No problem,

like I said, I can understand that it`s a fairly complicated task :-)

2014-09-09

Fahad Murtaza answers:

Looks like what? I think your attached image didn't go through. Please upload again.


wpenthusiast comments:

@Fahad, you are right, I included a link but it was removed for some reason. Let me try it again:

http://nekretnine-hrvatska.hr/sync.xml


Fahad Murtaza comments:

I see you are being helped already. Best!


wpenthusiast comments:

@Fahad,

I am looking for someone that know WP and can pull this off. Know anyone? ;-)


Fahad Murtaza comments:

Actually I do. His name is Fahad :)

I'd love to help you with this but I won't be available for two days. If it can wait two days, I can come up with a solution for you.

But I see a lot of other people here e.g Dbranes who have got a good idea of how to get it done. It basically needs a cron job ( wordpress cron can be used too ) and a custom export function to generate the xml from custom post types and their custom field.

We can discuss on Skype and I can give you a quote. Let me know and I'll PM you my email address and skype ID.