i have a XML file that i must to import in Wordpress. The problem is that my tags are not compatible with Wordpress.
So first, i load my XML with php :
$fichier = 'communiques.xml';
date_default_timezone_set('Europe/Paris');
$xml = simplexml_load_file($fichier);
And with foreach, change my tags.
My problem :
My "content" tags contain HTML tags. When i print my var, my content HTML return lot of array.
[h3] => Lorem ipsum ....
[p] => Array
(
[0] => SimpleXMLElement Object
(
[b] => Array
(
[0] => Lorem ipsum dolor
[1] => sit amet, consectetur
[2] => Tennis et padel
[3] => SimpleXMLElement Object
(
[br] => SimpleXMLElement Object
(
)
)
[4] => adipiscing elit.
[5] => Praesent id
[6] => lorem ac quam malesuada :
[8] => dapibus. Nunc posuere commodo lorem
)
[br] => Array
(
[0] => SimpleXMLElement Object
(
)
[1] => SimpleXMLElement Object
(
)
[...]
[46] => SimpleXMLElement Object
(
)
[47] => SimpleXMLElement Object
(
)
)
[i] => « Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent id lorem ac quam malesuada dapibus. Nunc posuere commodo lorem sed pretium. Aliquam malesuada placerat convallis. Vivamus sed orci eu ipsum congue tincidunt semper in justo. Nulla congue congue turpis at luctus. »
)
[1] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent id lorem ac quam malesuada dapibus.
)
[img] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[src] => uploads/folder/text_name.jpg
[alt] =>
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[src] => uploads/folder/perspective_2.jpg
[alt] =>
)
)
)
)
How can i display simply my content in my tag (with HTML tags) :
<content:encoded><![CDATA[ My content here ]]></content:encoded>
The rest works !