Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>');
- foreach($countries as $iso => $country) {
- $country_for_url = preg_replace( "/&([a-z])[a-z]+;/i", "$1", htmlentities( str_replace( ' ', '-', str_replace( "’", ' ', strtolower( $country ) ) ) ) );
- $item = $xml->addChild('item');
- $item->addChild('title', $country);
- $item->addChild('link', "https://davidelionetti.com/serveilvisto/per/$country_for_url/");
- $item->addChild('language', 'it_IT');
- $item->addChild('post_type', '<![CDATA[country]]>');
- $item->addChild('post_name', $country);
- $post_meta = $item->addChild('postmeta');
- $post_meta->addChild('meta_key','<![CDATA[Country]]>');
- $post_meta->addChild('meta_value',"<![CDATA['.$iso.']]>");
- $item->addChild('status', '<![CDATA[publish]]>');
- }
- Header('Content-type: text/xml');
- $file = $xml->asXML();
- print $file;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement