Frameworks
WordPress
An [orvia_map] shortcode — MapLibre from Orvia's CDN, key in wp-config.php.
Example
functions.phpphp
1<?php2// functions.php (or a small plugin). Put the key in wp-config.php:3// define('ORVIA_API_KEY', 'YOUR_API_KEY');4// Then use the shortcode [orvia_map] in any post or page.56add_action('wp_enqueue_scripts', function () {7 // Served from Orvia's own CDN — no dependency on foreign hosts.8 wp_enqueue_style('maplibre', 'https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.css');9 wp_enqueue_script('maplibre', 'https://orviamaps.ir/cdn/maplibre-gl@5/maplibre-gl.js', [], null, true);10});1112add_shortcode('orvia_map', function ($atts) {13 $atts = shortcode_atts(['lat' => '35.689', 'lon' => '51.389', 'zoom' => '11'], $atts);14 $id = 'orvia-map-' . wp_unique_id();15 $style = 'https://orviamaps.ir/api/v1/style.json?key=' . ORVIA_API_KEY;1617 wp_add_inline_script('maplibre', sprintf(18 'new maplibregl.Map({container: %s, style: %s, center: [%f, %f], zoom: %d});',19 wp_json_encode($id), wp_json_encode($style), $atts['lon'], $atts['lat'], $atts['zoom']20 ));2122 return '<div id="' . esc_attr($id) . '" style="height:420px"></div>';23});Replace YOUR_API_KEY with a key from your account, or read it from an environment variable as shown.