Prix de l’or
Affiche le prix de l’or dans la devise de son choix
// Add Shortcode function prix_or( $atts ) { // Attributes extract( shortcode_atts( array( 'currency' => 'CAD', ), $atts ) ); // Code $dom = new DomDocument; $dom->load("https://www.igolder.com/GoldData.ashx?type=Historical&hours=1¤cy=".$currency."&tz=35&unit=oz&output=xml"); $listePays = $dom->getElementsByTagName("Price"); $i = 0; foreach($listePays as $pays) { if ($i == 0) { return $pays->getAttribute("Value"); } $i ++; } } add_shortcode( 'prix_or', 'prix_or' );