Exemple #1
0
function map_ini()
{
    ?>
    <script>
        ymaps.ready().done(function (ym) {
            var myMape = new ym.Map('YMapsID', {
                center: [47.980359, 46.359042],
                zoom: 10,
                controls: ['zoomControl', 'fullscreenControl']
            }, {
                searchControlProvider: 'yandex#search'
            });

            var geoObjects = ym.geoQuery(<?php 
    echo return_points();
    ?>
)
                .addToMap(myMape)
                .applyBoundsToMap(myMape, {
                    checkZoomRange: true
                });
        });
    </script>
<?php 
}
function map_searcher_callback()
{
    check_ajax_referer('cr-special-string', 'security');
    $name = $_POST['val'];
    $term = get_term_by('name', $name, 'category');
    echo return_points($term->term_id);
    wp_die();
}